100 lines
3.4 KiB
Python
100 lines
3.4 KiB
Python
|
|
print('''
|
|
import math
|
|
|
|
Constantes:
|
|
pi, e, tau, inf, nan ( math.pi ; math.cos(0) )
|
|
|
|
Funciones:
|
|
ceil : Redondea al sgte. entero ej. ceil(3.2) devuelve 4
|
|
floor : Redondea al entero anterior ej. floor(3.2) devuelve 3
|
|
ceil : Valor absoluto ej. fabs(-4) devuelve 4
|
|
factiorial : Func. factorial ej. factorial(4) devuelve 24
|
|
|
|
Funciones de potencia y logarítmicas
|
|
exp : e^x ej. exp(1) devuelve e
|
|
expm1 : (e^x) -1 ej. exp(1)e -1 devuelve e-1
|
|
log : logaritmo natural ej. log(e) devuelve 1
|
|
log2 : logaritmo en base 2 ej. log(2) devuelve 1
|
|
log10 : logaritmo en base 10 ej. log(10) devuelve 1
|
|
pow : Potencia ej. pow(3,2) devuelve 9
|
|
sqrt : Raíz cuadrada ej. sqrt(9) devuelve 3
|
|
|
|
Funciones trigonométricas
|
|
acos : arco coseno ej. acos(1) devuelve 0
|
|
asin : arco seno ej. asin(0) devuelve 0
|
|
atan : arco tangente ej. atan(0) devuelve 0
|
|
cos : coseno ej. cos(pi) * devuelve -1
|
|
hypot : hipotenusa ej. hypot(1,1) devuelve 1.14121356...
|
|
sin : seno ej. sin(pi/2) * devuelve 1
|
|
tan : tangente ej. tan(pi/4) devuelve 0.99999999...
|
|
''')
|
|
|
|
print('''
|
|
Consola python
|
|
>>>
|
|
>>> import math
|
|
>>>
|
|
>>> help(math)
|
|
|
|
>>> math.sqrt(16)
|
|
4.0
|
|
>>>
|
|
>>> math.log(math.e)
|
|
1.0
|
|
>>>
|
|
|
|
# Libreria Random, forma parte de la libreria estandar de python
|
|
>>>
|
|
>>> import random
|
|
>>> random.random()
|
|
0.1430076482629129
|
|
>>> random.random()*10
|
|
6.753608889973483
|
|
>>> (random.random()*10)%6+1
|
|
2.279082688613001
|
|
>>> (int(random.random()*10)%6+1)
|
|
4
|
|
>>> (int(random.random()*10)%6+1)
|
|
4
|
|
>>> (int(random.random()*10)%6+1)
|
|
6
|
|
>>> (int(random.random()*10)%6+1)
|
|
4
|
|
>>> (int(random.random()*10)%6+1)
|
|
3
|
|
>>> clear
|
|
|
|
# Choice
|
|
>>> random.choice([1,2,3,4,5,6])
|
|
1
|
|
>>> random.choice([1,2,3,4,5,6])
|
|
1
|
|
>>> random.choice([1,2,3,4,5,6])
|
|
2
|
|
>>> random.choice([1,2,3,4,5,6])
|
|
4
|
|
>>> random.choice(['Rojo', 'Verde', 'Azul])
|
|
random.choice(['Rojo', 'Verde', 'Azul])
|
|
>>> random.choice(['Rojo', 'Verde', 'Azul'])
|
|
'Verde'
|
|
>>> random.choice(['Rojo', 'Verde', 'Azul'])
|
|
'Verde'
|
|
>>> random.choice(['Rojo', 'Verde', 'Azul'])
|
|
'Rojo'
|
|
>>> random.choice(['Rojo', 'Verde', 'Azul'])
|
|
'Verde'
|
|
>>>
|
|
|
|
# Choices
|
|
>>> random.choices([1,2,3,4,5,6], k=2)
|
|
[4, 6]
|
|
>>> random.choices([1,2,3,4,5,6], k=2)
|
|
[4, 3]
|
|
>>> random.choices([1,2,3,4,5,6], k=2)
|
|
[3, 4]
|
|
>>>
|
|
''')
|
|
|
|
|