[SciPy-user] Help !!!!

José A Martín H jose.martin at wanadoo.es
Mon Jun 7 14:14:42 EDT 2004


Why Mr Anderson Why ?????????.

Please need help
Can some one explain me what is going on in this two functions ?
why they are not equal ?
-----------------------------------------------------------------------
def Resta(B,N):
    X=3**(N-1)
        result=0
    
    for i in range(10):
        result+= (2**i) * X /(3**i)
    
    return (3**N)-result
--------------------------------------------------------------------
def RestaX(B,N):
    X=3**(N-1)
        result=0
    
    for i in range(10):
        result+=  X * ((2**i)/(3**i))
        
    
    return (3**N)-result
----------------------------------------------------------------------------

This is math.

Then sum( X * a) =  X * sum(a) being X a constant , is it true ????

Why in python is it not true ?

Thanks....
J.A. Martin.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20040607/f98d0c7f/attachment.html>


More information about the SciPy-User mailing list