uWatch Complex Number Support Message #1 Posted by hughsteers on 5 Nov 2008, 11:01 p.m.
For those interested in the uWatch complex number support...
I have now completed the first pass of the complex number support for the uWatch. All of the scientific functions (except gamma) now support complex numbers.
it’s pretty cool. For example, you can enter and calculate stuff like (1+i)^(1+i) much faster than on a HP15c.
eg “1.. ENT MENU Y^X” vs. “1 ENT fI ENT Y^X” and a long delay!
There are some known caveats. For example the complex display format could be better (e.g. the above is displayed as 0.273957+i0.5837 both “0”s could be eliminated, for example). and stuff like (-27)^(1/3) gives one of the complex roots rather than -3 (which would be preferable).
There are also some usability issues to resolve. I also need to so some more rigorous testing of results. Also there are a lot of suggestions from other people that would make improvements that are not in. also, err, i need to make ALG mode work for complex (will do this before the actual release). please dont load this beta if you use ALG mode!!
Im hoping to make a proper release of 1.3.7 end of this week. In the mean time, here is a link to the “bleeding edge” version in case you want to try it and send in bugs!
http://www.voidware.com/tmp/uWatch.hex
Also here are some of my notes reproduced:
Happy Hacking!
-- Hugh.
PS. its getting dangerously close to the time some people will have to throw away their slide rules :-)
---------------------------------------------------------
Changelog:
1.3.7
- fix for AM/PM indicator wrong during noon to 1pm.
- removed Conversions BASE-N (was incomplete and superseded by Rob's BASE mode).
- stack lift missing for; a ENT b OP '.' or 'e'. ie non-digit number entry.
- stack lift missing for; a ENT OP, then enter a number
- fixed: the +/- key does not properly negate a negative result from a previous calculation
- fixed: OP then +/- followed by number went back to entry.
- fixed after OP then clear +/- shows -0
- fixed: recalling values from storage registers overwrites the x register.
- removed delays from STO/RCL to avoid slowing down macro programs.
- added ABS function to menu.
- changed R>P and P>R so that X is the angle and Y is the arg.
- fixed: C or mode escapes from menu
-- Experimental complex number support
- base 4 ops
- complex; X<>Y, ROLL, STO, RCL, 1/x, x^2, PI, ABS, SQRT, Y^X, Y^(1/X)
- complex: LOG, EXP, LOG10, 10^X
- complex: SIN, COS, TAN, ASIN, ACOS, ATAN
- entry of complex number using repeated '.' ie a second '.' is re-interpreted
as the start of the imaginary part, unless an exponent exists, in which case
a single '.' starts the i part.
- added REAL, C>R, R>C, CONJ to third menu 2nd page; real-part,
split, join and conjugate.
Here are the complex number user notes:
*** user instructions and technical info for complex number support in the uWatch.
There is no complex mode! the uwatch performs complex number operations when a
complex number is present and does not need to be set into a special mode for
this. The calculator's internal functions test for the presence of an ipart in
order to perform the best calculation. importantly, when there is no ipart,
the calculation is the same as for normal real numbers so it remains
efficient, fast and in some cases more stable numerically than the complex
version. So there is no loss of efficiency and precision by not having a mode.
However, the lack of a dedicated mode means that some real number calculations
can result in a complex answer. for example sqrt(-2) and acos(1.2).
Complex numbers are implemented using a parallel stack, so there are shadow
ipart registers for X, Y, Z and T (and also the 10 memories). A complex number
occupies a single line of display just as do the normal reals. Naturally,
there is less room to display the number on one line, so the number of digits
is shortened appropriately (NOTE: a MANT/SHOW key is planned to peek the whole
precision using both lines simultaneously).
** Entry Method:
Enter numbers in the usual way, and initiate the entry of an ipart by pressing
"." either once or twice. When a decimal dot or exponent is already present,
pressing "." will initate the ipart entry. the screen will change to, for
example, "1.2+i" waiting for the ipart entry.
If there is no decimal place already, two "."s are required, for example, to
enter 1+i, enter "1..", you can leave it as +i or enter 1 if you like, both
are acceptable. for example "0.." enters the value "i" (ie 0+i).
The +/- change sign key can be used during the process of number entry to
affect the signs of number parts. Before EXP or "i" is entered, +/- changes
the sign of the mantissa, after EXP it changes the sign of exponent, after "i"
it changes the sign of the ipart and, lastly, after EXP again, changes the
sign of the ipart exponent (NOTE: a backspace key in RPN mode is planned to
help make corrections when entering long numbers).
Since the entry of a complex number can be longer than the 16 digits
displayed, the number will scroll left on entry accommodating the rightmost
digits (NOTE: you cannot currently scroll back before entry).
** Functions supporting complex numbers (current list)
* base 4 ops (+ - * /)
* stack ops; ROLL, X<>Y, ENTER
* memory ops: RCL, STO
* 1/X, X^2, SQRT, ABS (modulus), Y^X, Y^(1/X)
* LN, EXP
* LN10, 10^X
* SIN, COS, TAN
* ASIN, ACOS, ATAN
* complex specific;
C>R = split complex into X, Y registers
R>C = combine X+iY into complex
CONJ = complex conjugate.
REAL = real part.
** Functions not operating on complex numbers
* R->P, P->R (always set ipart to 0) useful with C>R and R>C
* Factorial (gamma)
* complex BASE mode (!)
* // (parallel), should this do something clever with power etc?
*** NOTES
Trig functions of complex numbers only makes sense in radians, but since there
is no complex mode, the angular mode cannot be ignored. consequently, a trig
function in DEG mode will apply to a complex number by converting it to
radians.
Since we are modeless, R>P and P>R cannot perform special case operations for
complex numbers (eg working with polar complex), so instead there are C>R
and R>C split and combine operations which separate a complex number into
two stack levels x & y and the reverse. like this, the complex number can be
operated as polar by performing; C>R R>P R>C
Also, the split is a useful way to see a complex number at full precision
(then use combine to put it back).
**** Philosophy behind the complex number support
Some of the way in which the uWatch complex numbers work is different from
that on HP calculators. The calculators tend to have a complex number mode in
which some operations (eg P->R and R->P) work differently.
For the uWatch, i didnt want the complex number implementation to any way
interfere with the normal numeric operations. This is because complex numbers
are an advanced feature which many users will be unaware of, especially at
first.
The amount of time i read users posting on forums saying their 15c has a little
"c" on the screen and has gone into a mode where things work differently,
means that modes are confusing. It's really, really annoying when your
calculator/pda/phone etc. goes into a funny mode which works in a differnt way
and you're out in the field and dont have the manual and you dont know how to
get it back to normal. You wind up resetting the unit as a last resort!
There is also an argument that DEG/RAD should not be a mode. being in the
wrong angle mode has had me over in the past and i would guess it has been the
same for everyone else. However, the DEG/RAD mode is so ingrained and expected
that it would be wrong not to support it.
not having a complex mode creates a few problems. The uWatch cannot simply
look at the number to see if it has an ipart because the ipart may just happen
to be zero and it would be a mistake to operate with the number in different
way.
For example, the 15c R->P function converts a complex number into its angular
form when in complex mode, but operates on X & Y stack registers
otherwise. The uWatch cannot mimic this, so instead it offers functions to
split a complex into the X & Y registers (C>R), and another to combine them, R>C. In
this way P->R and R->P can always perform the same operation. To this effect,
they reset any residual ipart on X & Y.
|