complex math module problem ?

i have many functions using simple cos and sin

but since i added the complex mathc module for one special class/function

i get an error inside all the other class
like the values are calculated with complex value instead of real value

i’m calculating verts X Y Z for a mesh data
and the cos sin are taken as complex value by default!

how come the functions are assumed to be complex instead of real numbers?

is the order in which you load math and cmath is improtant here ?

another example if i write this it does it with complex numbers

print ('2.3cos(0.1) =’,2.3cos(0.1))
this gives

2.3*cos(0.1) = (2.288509580139459+0j)

how can i stop it ?


cmath = math functions done with complex numbers

I don’t see the problem here, if you don’t want that use the math module instead.

You could use scoping instead of ‘from math import *’…

can you elaborate a little!

i read the python page on cmath
and it looks now that you cannot use math and cmath at same time!

but how does it work when you do like example for a cos function
does it gives a real value or complex value ?



import math
import cmath

x = math.cos(0.1)

x_complex = cmath.cos(0.1)

ok i see the scoping effect !

but why is there a note now on python page for cmath saying that you should not use Cmath with Math module at same time?

this is a problem if you have 200 sin cos function in a script!

is the order of module loading influence it ?