Usando Python en la escuela

484 views
341 views

Published on

This a simple but interesting use of python in scholl homeworks my son at 7th year.
I used ipython 1.0 to script and to generate tex template. Finally used pdftaltex to get this PDF.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
484
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Usando Python en la escuela

  1. 1. CombinacionesFracciones Milton Labanda December, 2013 In []: """ @author: Milton Labanda 1000ton.lab@gmail.com @date: Diciembre 2013 @description: Ejercicio de Matemáticas 7mo año de Educación Básica Tema: Suma de Fracciones Mixtas Ubica los números mixtos en los círculos de forma que cada lado del triángulo sume 10 17/30: 1 1/30, 2 2/15, 3 7/10, 3 1/5, 4 1/6, 1 4/15, 4 1/10, 2 1/5 2 3/10 """ In [1]: from IPython.display import Image In [4]: Image(filename="/home/miltonlab/Imágenes/triangulo2.jpg") Out [4]:
  2. 2. In [94]: import itertools In [93]: from fractions import Fraction In [74]: fracciones = [Fraction(31,30), Fraction(32,15), Fraction(97,30), Fraction(46,15), Fraction(25,6), Fraction(19,15), Fraction(41,10), Fraction(11,5), Fraction(23,10)] In [75]: combinaciones = list(itertools.combinations(fracciones,4)) In [95]: len(combinaciones) Out [95]: 126 In [76]: # combinaciones de las fracciones para generar los lados lados = [c for c in combinaciones if sum(c) == Fraction(317,30)] In [77]: lados
  3. 3. Out [77]: [(Fraction(31, 30), Fraction(32, 15), Fraction(97, 30), Fraction(25, 6)), (Fraction(31, 5)), (Fraction(31, 10)), (Fraction(31, 10)), (Fraction(32, 10))] 30), Fraction(97, 30), Fraction(41, 10), Fraction(11, 30), Fraction(46, 15), Fraction(25, 6), Fraction(23, 30), Fraction(25, 6), Fraction(19, 15), Fraction(41, 15), Fraction(46, 15), Fraction(19, 15), Fraction(41, In [78]: # combinaciones de los lados triangulos = list(itertools.combinations(lados, 3)) In [91]: # Seleccionamos solo los triangulos que tienen circulos que se repiten # maximo 2 veces, es decir los vertices respuestas=filter( lambda t: len(set(t[0] + t[1] + t[2])) == 9,triangulos) In [92]: respuestas Out [92]: [((Fraction(31, 30), Fraction(97, 30), Fraction(41, 10), Fraction(11, 5)), (Fraction(31, 30), Fraction(46, 15), Fraction(25, 6), Fraction(23, 10)), (Fraction(32, 15), Fraction(46, 15), Fraction(19, 15), Fraction(41, 10)))] In []:

×