News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Library of functions for complex numbers

Started by raymond, January 27, 2005, 03:38:16 AM

Previous topic - Next topic

NaN

#15
Quote from: raymond on February 16, 2005, 01:57:41 AM
... and inadequate input from a user will have to live with the consequences of a corrected angle.


Maybe im wrong, but im getting the feeling your upset with me?  They are just suggestions.  I can easily finishes the fixes for myself.  Its no biggy for me...

As it stands now -1<0 * -1<0 * -1<0 = 1 < 3pi (which in theory is fine, but in practice decmal places will add up into FPU loss of accuracy).   My latter suggestion to fix angles over 360 deg is still not really corrected for....

Sorry if all this offends you.
Regards,
:NaN:

raymond

NaN

I am far from being offended or upset by any comment related to the library. To the contrary, I am extremely pleased. I do want this library to be as useful as possible. The suggestion related to negative vectors was immediately included after a clear explanation was provided.

The only reason for adding the comment in my last post about inadequate input was simply a warning to potential users that such input would be modified as if it would be legitimate input.

I would be most interested in learning what would be the typical sequence of math operations on complex numbers in your field. It would help me define which functions may need to be altered to reduce the angle to the -pi to +pi range.

Many thanks for your interest

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Ratch

raymond,

According to my FPU documentation, you don't have to worry about large trig function arguments, unless the absolute range of 0 to 2^63 is exceeded.  If outside that range, one must subtract an integer multiple of 2*pi.  Otherwise, the FPU will unwind the argument.  One assumes it is smart enough to do that without sacrificing accuracy.  It is most convenient if the inverse trig functions return their principal values, which are defined in any good math reference.  That means the angle is between plus or minus pi radians depending on the function.  Don't forget that hyperbolic functions have a periodicity too.  For instance, sinh(x+2*k*pi*i) = sinh(x), where k is any integer.  You don't want to compute with a large orthogonal number for accuracy's sake.  Finally, it would be nice if there was a degree and grad mode (one hundred grads to a quarter) to complement the current radian mode.  Ratch

raymond

I am not too concerned either about the functions which would require the conversion of polar coordinates to cartesian before applying other operations.

However, if the natural log of an unaltered complex number is computed, the size of the "angle" will have a definite effect on the result:
ln(r,t) = ln(r) + t
and converting the result back to polar, the new "t" would be: atan[t/ln(r)]

And atan[(t+2pi)/ln(r)] would not be the same. That's why I need some feedback from potential users.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

raymond

QuoteWithin the next few weeks, I will also make my fractal program available from the same link. I'm currently reworking its help file to reflect the use of threads in the revised program. (Fractal art makes extensive use of complex numbers.)

Since that posting, another thread on fractals was started by someone else. I have thus used that thread to indicate where my fractal program can be downloaded and will continue to use it for discussions related to it.

http://www.masmforum.com/simple/index.php?topic=866.0

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Mark Jones

Raymond, your fractal program is awesome! And the executable is only 52k!?! :dazzled: If you use "UPX193b -9" on it, it can be further squeezed down to 17,920 bytes, maybe even smaller if POLINK were used!
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

raymond

QuoteRaymond, your fractal program is awesome! And the executable is only 52k!?!

Glad to hear you liked it. The size may be a bit misleading. One should remember that it is a "Windows" program and many APIs are used. If such a program with all its features (such as the auto-hide menu, movable dialog boxes, threads, etc. etc.) had to be written in the old DOS system, it would probably have had a 10-fold increase in size.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com