Contents
About
This JavaScript program performs the following complex arithmetic operations:
z = x + y add y to x z = x - y subtract y from x z = x * y multiply x by y z = x / y divide x by y z = 1 / x inverse of x z = x^2 x squared z = sqrt x square root of x z = | x | absolute value of x z = arg x argument of x in radians z = exp x base e raised to power x z = ln x natural logarithm of x z -> x copy z to x z -> y copy z to y x <=> y swap x and y
To operate the calculator, enter the values of complex numbers into x and y and then press the button corresponding to the desired operation.
To reset the input windows, press the Clear button.
Source Code
The Java Script source code for this program can be viewed by using the View|Source command of your web browser.
You may use or modify this source code in any way you find useful, provided that you agree that the author has no warranty, obligations or liability. You must determine the suitablility of this source code for your use.
Discussion
A complex number is represented as:
z = a + jb
where j2 = -1. Letting,
x = a + jb
y = c + jd
r = sqrt (a2 + b2)
t = arctan( b/a )
the operations of the calculator are performed as follows:
x + y = (a + c) + j(b + d)
x - y = (a - c) + j(b - d)
x * y = (ac - bd) + j(ad + bc)
x / y = [(ac + bd) + j(bc - ad)] / (c2 + d2)
1 / x = (a - bj) / (a2 + b2)
x2 = (a2 - b2) + 2abj
sqrt x = (sqrt r)(sin t/2 + j cos t/2)
| x | = sqrt (a2 + b2)
arg x = arctan( b/a )
exp x = ea(cos b + j sin b)
ln x = ln r + j t
The calculator computes only the principle value for multivalued functions.
Elementary Mathematical Analysis
AbCd Classics - free on-line books