Since I develop RB applications on Linux from time to time, I couldn't use
Bob Delaney's ComplexPlugin (which is a great Plugin, by the way). For that
reason, and also for the sheer fun of it, I decided to roll my own Complex
Class, written in RB and open source.
The Complex class overloads the standard operators (+, -, *, /, ^) for
complex numbers, and it implements a number of mathematical functions
already available in RB (abs, sqrt, exp, log, sin, cos, tan, asin, acos,
atan) for complex numbers. It also adds a series of new functions (conj,
inv, norm, Cot, Sec, Cosec, Sinh, Cosh, Tanh, Asinh, Acosh, Atanh) for
complex numbers.
Any feedback and/or contributions will be appreciated.
The project archive can be found at the following URL:
http://www.the-meiers.org/opensource/
Thanks,
Roger
Roger,
I note that you use the standard code for a complex multiply:
(a + i*b) * (c + i*d) = ( (a*c) - (b*d) + i*((a*d) + (b*c)) )
This requires 4 multiplications and 2 additions. Since a
multiplication of doubles takes considerably longer than does an
addition, you might want to consider using the following:
x + i*y = (a + i*b) * (c + i*d)
ac = a*c
bd = b*d
y = (a + b)*(c + d) - ac - bd
x = ac - bd
which requires 3 multiplications and 5 additions.
Bob
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>