def histogramBlock_Normalisation(hist):
     sum = 0
     hist_norm = []
     for i in range(36):
         sum += hist[i]**2
     for i in range(36):
         hist_norm.append(hist[i] / math.sqtr(sum))
     return hist_norm
示例#2
0
def check_prime(n):
    count=0
    for i in range (2, math.floor(math.sqtr(n))+1):
        if n % i == 0:
            print('the number is not prime')
            break
        count = count + 1
    if count+2 == math.floor(math.sqrt(n))+1:
        print('the number is prime')
示例#3
0
import math

px = int(input("Informe a coordenada x círculo: "))
py = int(input("Informe a coordenada y círculo: "))
r + int(input("Informe o raio do círculo: "))
qx = int(input("Informe o coordenada x do ponto: "))
qy + int(input("Informe o coordenada y do ponto: "))

raiz = (px - qx) ** 2 + (py - qy) ** 2

dist + math.sqtr(raiz)

if dist > r:
    print("O ponto està fora do cìrculo")
else:
    print("O ponto está dentro do círculo")


示例#4
0
#!/usr/bin/python

import math

# Because you used import you can access methods by referencing the module
print("ceil(4.4) = ", math.ceil(4.4))
print("floor(4.4) = ", math.floor(4.4))
print("fabs(4.4) = ", math.fabs(4.4))

# Factorial = 1 * 2 * 3 * 4
print("factorial(4.4) = ", math.factorial(4))

# Returns the reminder of division
print("fmod(5,4) = ", math.fmod(5, 4))

# Recieve a float and return an int
print("trunc(4.4) = ", math.trunc(4.4))

# Return x y
print("pow(4,4) = ", math.pow(4, 4))

# return the squre root
print("sqtr(4.4) = ", math.sqtr(4.4))
示例#5
0
def dist(point1, point2):
    return math.sqtr((point1[0] - point2[0])**2 + (point1[1] - point2[1])**2) 
"""
Entradas
A-->int
B-->int
C-->int
Salidas
D-->int
"""
import math
A=int(input("Digite el valor de A: "))
B=int(input("Digite el valor de B: "))
C=int(input("Digite el valor de C: "))
D=((B**2)-(4*A*C))
if(D==0):
  X1=(-B/(2*A))
  X2=(-B/(2*A))
  print("Los valores de X1 y X2 son: "+str(  X1,X2))
elif(D>0):
  X2=(-B+math.sqtr((B**2)-(4*A*C)))/(2*A)
  X3=(-B+math.sqtr((B**2)-(4*A*C)))/(2*A)
 print("Los valores de X2 y X3 son: " +str(X2,X3))
elif(D<0):
  print("No tiene solucion en los reales")
else:
  print("Error")
示例#7
0
>>> b=2
>>> a!= r b==1
SyntaxError: invalid syntax
>>> not(a==1)
False
>>> a!=1 or b==1
False
>>> math,sqrt(8)
Traceback (most recent call last):
  File "<pyshell#67>", line 1, in <module>
    math,sqrt(8)
NameError: name 'math' is not defined
>>> import math
>>> math.sqrt(8)
2.8284271247461903
>>> math.sqtr(9)
Traceback (most recent call last):
  File "<pyshell#70>", line 1, in <module>
    math.sqtr(9)
AttributeError: module 'math' has no attribute 'sqtr'
>>> math.sqrt(9)
3.0
>>> 1+1+1==3
True
>>> is_ready = bool
>>> if not is_ready == false
SyntaxError: invalid syntax
>>> not is_ready -- False
Traceback (most recent call last):
  File "<pyshell#75>", line 1, in <module>
    not is_ready -- False
示例#8
0
    a = input()

    print("Ingrese lado F")
    f = input()
    print("Ingrese lado G")
    g = input()
else:
    if(tr==2):
        print("Equilatero Ingrese valor de lado")
    
        a=f=g= input()
else:
    print("Isoceles Ingrese primero los dos lados iguales y luego el distinto")
    a = f = input()
    g = input()
    
a=int(a)
f=int(f)
g=int(g)
b=int(b)
h=int(math.sqtr((a**2)-((b/2)**2))
perimetro=int(perimetro)
base=int(g)

perimetro = a+f+g
print("El perimetro es ")
print(perimetro)
print("El area es")
print((b*h)/2)