Vedic Calculator

22
Multi-Precision Library Multi-Precision Library based on Vedic Mathematics Vedic Mathematics Presented by: Presented by: Divyang panchasara Divyang panchasara

description

This calculator has been developed by me. It gives high precision results which Normal calculator can not give. It is helpful in calculations for Space technology, Supercomputers, Nano technology etc. I can give this calculator to interested people.

Transcript of Vedic Calculator

Page 1: Vedic Calculator

Multi-Precision LibraryMulti-Precision Librarybased on

Vedic MathematicsVedic Mathematics

Presented by:Presented by:

Divyang panchasaraDivyang panchasara

Page 2: Vedic Calculator

Project GoalProject Goal

To give multi-precision, i.e. as many precision digits required for any calculations.

To give maximum accuracy up to the precision wanted that the normal built in computer functions can not give .

To implement the principles of Vedic mathematics and various approximation algorithms for series calculations.

Create a function parser to process any equation.

Page 3: Vedic Calculator

SAMPLE COMPARISION BETWEEN VEDIC & SAMPLE COMPARISION BETWEEN VEDIC & GMP METHODGMP METHOD

As shown in the example graph, the straight division method given by Vedic mathematics is much faster than even the GMP method which is assumed to be very fast.

Page 4: Vedic Calculator

Vedic MultiplicationVedic Multiplication

The following method explains how to solve long multi-precision numbers by bit-wise calculations.

The product of 6471 x 6212 can be computed as:

6 6 4 6 4 7 6 4 7 1 4 7 1 7 1 1 x x x x x x x

6 6 2 6 2 1 6 2 1 2 2 1 2 1 2 2

36 12+24 6 + 8 + 42 12 + 4 + 14 +6 8 + 7 + 2 14 + 2 2

40 1 9 7 8 5 2

4 5 3 1 1

Page 5: Vedic Calculator

Why More precision?Why More precision?

The idea for developing such a library has come from the requirements of astronomical sciences as well as Nano and Pico level calculations.

The astronomical calculations include calculations of orbital routes, etc. and these involve high precision and accuracy because of the high unit it uses, ex. Light years.

Nano calculations require high precision to ensure correctness. Hence high precision mathematics is required to avoid inaccuracy.

Page 6: Vedic Calculator

Software Development Life Software Development Life CycleCycle

Requirement Definition

System and Software design

Implementation & unit testing

Integration and system testing

Operation and maintenance

Page 7: Vedic Calculator

SYSTEM REQUIREMENT SPECIFICATION:SYSTEM REQUIREMENT SPECIFICATION:

Project is made to support Vedic mathematics concepts and Series Algorithms that can help to reduce the processing time and increase accuracy.

Vedic mathematics should help in getting high precision in calculations which ordinary computer can not give due to overflow problems as well as complex logic.

Functions made by use of Vedic mathematics and the Algorithms should help in very low speed -processing (chip) and very high speed processing like supercomputer.

Make use of lower or middle level language in developing functions so that they can be supported and used by any higher level application.

Create library from the functions created by the principles which can be used to develop an application by higher level language.

All the calculations to be done with inputs in string format to prevent overflow, as well as use the normalized form for all calculations.

Page 8: Vedic Calculator

SYSTEM AND SOFTWARE DESIGN:SYSTEM AND SOFTWARE DESIGN:

Architectural design: The functions and the modules are defined and documented.

Abstract and method specification: The optimal method and algorithms for each method are decided and an abstract specification under the constraints under which the functions work must be decided under which the program is going to operate.

Interface Design: For each functions the interface and convention with all the other functions must be designed and documented.

Algorithm Design: Each of the algorithms is framed for each function in the program.

Parser Design: The function parser is designed from scratch on basis on which concept to follow and how to implement it.

Application Design: The final user-level application should be designed in such a way so as to meet the user requirements.

Page 9: Vedic Calculator

CODING AND DEBUGGING:CODING AND DEBUGGING:

Code the `+`, `-`, `*` & `/` operators first and ensure their functioning to be perfect.

Make algorithms for implementing the logarithm and exponential functions.

Make series functions using approximation methods.

Make the derived functions such as power, nthroot, etc, which are based on the logarithmic function.

Debug all the functions and make them error-free.

Page 10: Vedic Calculator

SOFTWARE VALIDATION:SOFTWARE VALIDATION:

Unit Testing: The basic operator functions were individually tested and ensured to be free from errors.

Function Testing: All the other basic operator functions which were made on basis of the operators and algorithms were independently tested and validated to be giving expected outputs for specific inputs.

Parser Testing: The function parser is based on Reverse Polish notation and hence the precedence rule has to be taken care of.

Application Testing: The application level program should be validated and tested depending on the requirement of the user.

Alpha Testing: This testing continues till the client agrees that delivered system is an acceptable implementation of system requirements.

Page 11: Vedic Calculator

ApplicationsApplications A DLL file would be created that could be used in higher level applications.

A Visual Basic application would be created that could provide users a GUI for solving high precision mathematical calculations.

A function parser would be developed which would be used to process the standard format equations directly.

A file-handling project would be made which would process a whole input file and generate and output file.

A Web application would be developed to solve multi-precision equations online.

An application would be developed for calculating orbital routes of Earth and Mars which would be used by a research agency based in U.S..

A Firmware chip would be made by our company in future that could be used on any platform to get high precision calculations with maximum accuracy.

Page 12: Vedic Calculator

SOFTWARE EVOLUTION:SOFTWARE EVOLUTION:

The Vmat library has been in a flexible way. Hence there remains scope of evolution.

Each function would be constructed in generalized exponential form to increase calculation limits.

A DLL should be created including all the functions we have made so that it can be distributed and anyone can use our functions in any programming language.

Rest changes are based on changing requirements and customer needs.

Page 13: Vedic Calculator

Dependency:Dependency:

The VMAT Multi-Precision Library is not dependent on any specific system or software configuration.

The Library has been made as much independent of platform as possible.

The overflow problem is solved by using the string variables and not any predefined data types.

As self made functions are used there are minimal chances of any approximations.

Page 14: Vedic Calculator

MODULESMODULES Basic operator functions.

(+, -, *, /, sqrt)

Trigonometric & Hyperbolic functions by making use of basic operators.(log, exp, sine, cos, tan, sinh, cosh, asin, acos, atan, asinh, acosh, etc.)

Library of functions constructed by integrating all the functions.(Vedic.h file)

Function parser to process and evaluate equations.(parser.h)

File handling project which takes input file of equations and generates output file.(Vedic.c)

Page 15: Vedic Calculator

Tools And LanguageTools And Language The mathematical library would be made in C Language. The choice

of C-Language was made because of many reasons. First of all C is a very robust language with rich set of built in functions of string.

C compiler combines the capabilities of an assembly language with features of a high level language hence it is very well suited for writing system software.

C-Language is highly portable. This means that C programs written for one computer can be run on another with little or no modification. Portability is very important for our project because it can be used by anyone on any platform.

C-Language is suited for structured programming, thus requiring the user to think of a problem in terms of modules and blocks. A proper collection of these modules make a whole program. The modular programming makes debugging, testing and maintenance easier.

Another important feature of C is its ability to extend itself. A C Program is basically a collection of functions that are supported by the C Library. We can continuously add our own functions thereby making our programming easier.

Page 16: Vedic Calculator

Standard Convention:Standard Convention: All the input values should be taken in string variables. The input can be normalized or any standard exponential form. None of the computers built in functions should be used till

possible extent. All the processing should be done in normalized form of input. All the functions should be integrated in one common file to

prevent any re-declaration or overlapping. Create functions to optimize the inputs to prevent unnecessary

calculations. All the functions should be internally compatible with each

other. All the trigonometric functions should be made by the use of

the arithmetic functions made by us to prevent loss of accuracy.

All the outputs should be in standard exponential format and these conversions should take place at the application level.

The function parser should strictly follow the operator precedence rule and error functions to be set for invalid data.

Page 17: Vedic Calculator

Cost & other featuresCost & other features

In this project the material costs are not much as any reasonable system would work, but the main cost accounts for the human resource.

The knowledge of Vedic Mathematics is taken by studying the books written on it and the mathematical concepts are taken from freeware research labs.

The time factor and project duration also account much to the cost of the project.

As the research phase consumes a lot of time and hence much human resource.

After the research, the development and testing phase also consumes reasonable amount of time, effort and resources.

Cost of product will be discussed with Customer mutually.

Page 18: Vedic Calculator

System flow diagramSystem flow diagram

Page 19: Vedic Calculator

Flowchart Of ApplicationFlowchart Of Application

Page 20: Vedic Calculator

MilestonesMilestones Study phase

↓Implementation of Basic operators in C

↓Error testing

↓Use of basic operators in Trigonometric functions

↓Framing error functions for

Invalid inputs to all functions↓

File-handling program to generateOutput file from input file for

single operator functions↓

Construct functions to take any input and generate standardized output

↓Making a function parser to

process equations↓

Optimize library with necessaryerror functions

↓File-handling program to generate

Output file from input file for multipleequation solving

↓Develop an application in a

Higher level language

Page 21: Vedic Calculator

Glossary Of FunctionsGlossary Of Functions add(x, y): Returns the addition of two multi-precision values. sub(x, y): Returns the subtraction of two multi-precision values. mul(x, y): Returns the multiplication of multi-precision numbers calculated by

Vedic principles. divide(x, y): Returns the division of x by y based on Vedic principles. vroot(x) : Returns the square-root on x based on Vedic principles. trim_leading_zeroes(x): Trims all the zeroes leading x and optimizes the values

with various error functions. trim_trailing_zeroes(x): Trims all the zeroes trailing x and optimizes the values

with various error functions. scmp(x,y): Compares equality of two multi-precision numbers stored in string

format. sfrexplm(x): Splits the given number into mantissa and exponent, i.e. x = m + 2 e.

and returns mantissa. sfrexple(x): Splits the given number into mantissa and exponent and returns

exponent. sfloor(x): Returns the floor value of a multi-precision number stored in a string. spolevll(x, y, z): Evaluates the polynomial with three parameters. sp1evll(x, y, z): Evaluates the polynomial with according to requirement of log

function. loglll(x): Returns multi-precision natural logarithm of the given number upto

accuracy of about 100 digits. explll(x): Returns multi-precision natural anti-logarithm, i.e. ex of the given

number x.

Page 22: Vedic Calculator

sinlll(x): Returns the multi-precision sine of the given number in radians. coslll(x): Returns the multi-precision cosine of the given number in radians. tanlll(x): Returns the multi-precision tangent of the given number in radians.

This is simply calculated by values derived from the sine and cosine of the given number.

nortoe(x): Transforms the normal form value into exponent form and also converts non-standard exponent form into standard exponent form.

etonor(x): Transforms the exponent form value into normal form with all the optimizing functions set.

bfore(x): Returns the value before the exponent part in an exponent form of number.

aftere(x): Returns the exponent part of the given number in an exponent format.

expadd(x,y): Adds an exponential form of number and an exponent stored before calculations to get final answer in functions.

txpadd(x,y): Simply adds two exponent values of two exponential form values. It’s used inside the functions to carry on exponential calculations.

sinhlll(x): Calculates hyperbolic sine of the given value x. coshlll(x): Calculates hyperbolic cosine of the given value x. tanhlll(x): Calculates hyperbolic tangent of the given value x. asinlll(x): Calculates inverse sine in radians of the given value x. acoslll(x): Calculates inverse cosine in radians of the given value x. atanlll(x): Calculates inverse tangent in radians of the given value x. asinhlll(x): Calculates inverse hyperbolic sine of the given value x. acoshlll(x): Calculates inverse hyperbolic cosine of the given value x. atanhlll(x): Calculates inverse hyperbolic tangent of the given value x.