[docs] math and Cmath lib interferences
Ricky John
richardterrelive at live.ca
Tue Aug 9 16:03:46 CEST 2011
to whom it may concern here are a few suggestions to make life easier with python at least i hope
http://docs.python.org/bugs.html
mailto:docs at python.org
I'm not a programmer but i like to use Python with Blender and like to work with Complex numbersbut right now i think there is room for improvement for the Cmath lib or add a new lib may be.
so here are a few suggestions:
1- Interference between math and Cmath lib
# http://docs.python.org/library/math.html#module-math
# http://docs.python.org/library/cmath.html#module-cmat
if these 2 modules are loaded and you try to find a log10 for a real number you get by default the Cmath.log10(x) with a Complex Result!
i think it would be more logical to default to math.log10(x) for X being a real number which is not the case right now!
Suggestion:
change the name for Cmath log10 for something like Clog10(x) to get a Complex number for X and the result!
then by default log10 for X real would be a real number and not a complex one!
Other functions which could be change too:
cmath.sqrt(x)¶ ---> cmath.csqrt(x)¶
cmath.log(x[, base]) ---> ¶cmath.Clog(x[, base])¶
cmath.exp(x)¶ ---> cmath.cexp(x)¶
cmath.acos(x)¶ ----> cmath.cacos(x)¶
cmath.asin(x)¶ ----> cmath.casin(x)¶
cmath.atan(x)¶ ----> cmath.catan(x)¶
cmath.cos(x ----> cmath.ccos(x
cmath.sin(x) ----> cmath.csin(x)
cmath.tan(x)¶ ----> cmath.ctan(x)¶
cmath.acosh(x)¶ ----> cmath.cacosh(x)¶
cmath.asinh(x)¶ ----> cmath.casinh(x)¶
cmath.atanh(x) ----> cmath.atanh(x)
cmath.atanh(x)¶ ----> cmath.catanh(x)¶
cmath.cosh(x)¶ ----> cmath.ccosh(x)¶
cmath.sinh(x) ----> cmath.csinh(x)
cmath.tanh(x)¶ ----> cmath.ctanh(x)¶
Unless the Argument is complex then it would use the Complex function but for real number it should default to the math lib functions.
2 - C math Polar operators
Right now it appears that polar operators don't exist
Suggestion add new polar Operators + - X / using polar values
Ex: Z1=120 /__ 0 Radian angle
z2= 10/__1 Radian angle
New operator Polar + : Z1+ Z2 = 120 /__ 0 + 10/__1
Polar - : Z1/ Z2 = 120 /__ 0 - 10/__1
Polar X : Z1/ Z2 = 120 /__ 0 X 10/__1
Polar / : Z1/ Z2 = 120 /__ 0 / 10/__1
Note: In electrical engeenering we very often use polar notation for Voltage current and Z impedance values
because it is easier to visualize it with angle then using the rectangular form.
I think this would make Cmath more user friendly in any case! if possible make the angle like 120D or 1.5R for having the flexibiliy to give angle in degrees or radians!
3- complex matrix it might also be very usefull to have the basic capabilities to work with and solve complex matrix like we do in electrical engeneering calculations hope this can be inmplemented too may be inside the Cmath lib!
i hope these suggestions make sense and also hoping these can be implemented to make life easier with python thanks & have a nice day Richard Jean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110809/76d4906e/attachment.html>
More information about the docs
mailing list