well i made a mistake again :P. i have the function x ^ 1/3, i first remembered that negative numbers do not have a square, but in this case negative numbers are ok...because it aint 1/2 ...its 1/3. Can anyone give a hint of how i can calculate it without using pow ou **? none of them work properly
Tiago Katcipis escreveu: > im not understanding why is this a problem...i have this simple function > > def newton_divergente(x): > return math.pow(x, 1.0/3.0) > > but when x = -20 it returns this error > > return math.pow(x, 1.0/3.0) > ValueError: math domain error > > but why is that? is it impossible to calculate -20 ^ (1/3) ? > > here on my calculator i get the result -6,666666667, but python seens to > dont now the answer, why? am i doing something wrong? =/ > > thanks to everyone who tries do help > > best regards > > katcipis > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor