29 December 2013

Prime Factorial

While doing some random computing I accidently found out something.
(2!+1)/3=1
(3!+1)/4=Fraction
(4!+1)/5=5
(5!+1)/6=Fraction
(6!+1)/7=103
Only when the denominator is a prime the quotient will be an integer.
Let n be prime
Then ((n-1)!+1)/n will be an integer.
I computed it to really large numbers and seemed to hold.
Don't yet know if its generally true.

Update: This theorem is called Wilson's Thoerem.

21 December 2013

[C++][Project] Calculator + Automatic Syntax Checking + Complex Analysis


This is my first ever C++ coding project.The main motivation behind it was a Casio scientific calculator I once owned and I had a hard time figuring out the syntax.

I have only 2 year experience studying Borland C++ in school.So please don't go too technical in comments. This is a genuine piece of work and no code has been borrowed from anywhere.I am open to suggestions and you are free to use the code in any way you please.


Overview:

This is a scientific calculator with support for complex analysis.(support calculations and functions of complex numbers)
It automatically check for syntax errors.You can only enter valid syntax.
The program is written entirely using basic input and output manipulation techniques and inbuilt math functions.Thus it has limitations when it comes to precision and possible logical workarounds are implemented wherever possible.

Changelog:

V4.5
+Rewrote in GCC compiler

V4.4
+Very tiny Bugfix

V4.3
+Very tiny bugfix

V4.2
+Removed Gamma function for computing factorial.
+Bugfix: Inverse Cos.
+Error handling: 0th root.

V4.1
+Fixed approximation bug in complex power function.
+Changed the way evaluation code handle 'i' and '-'.

V4.0
+Optimised evaluation technique(Functions are evaluated first).
+Minor Tweaks in Syntax checking.
+Optimised code converting string to long double.
+Bugfix in complex log function.
+Bugfix: i^x bug.
+Tweak: Precise ambiguity.
+Cleaned up the code.

V3.7
+Temporary bugfix for i^x bug.

V3.6
+Complex Math By GenX introduced.
+Support for complex functions.
+Redid evaluation code.

V3.5
+Added support for complex numbers.
+ -,+,*,/ operations on complex numbers supported.
+Tweaks in syntax checking
+Tweaks in evaluation

V3.2
+Redid a major part of the program to remove bugs.
+ √ function added

V3.1
+Added support for inverse functions.
+Tweaks in syntax checking.
+Tweaks in evaluation.

V3.0
+Added support for functions: cos, sin, tan, log .....
+Tweaks in syntax checking.
+Tweaks in evaluation.

V2.9
+Bugfix: Backspace handling in syntax checking.

V2.8
+Added Help
+Syntax checking calls help after a number of invalid entries.

V2.7
+Added nCr , nPr and factorial operations.
+Tweaks in syntax checking.
+Tweaks in evaluation.

V2.6
+Compiled as independent program.
+Bugfix in syntax checking.

V2.5 and earlier
+The program was part of X Shell a dos like command prompt written in C++.
+Supports only +,-,/,*,(,) operators.