Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
CombinacionesFracciones
Milton Labanda
December, 2013
In []: """
@author:

Milton Labanda
1000ton.lab@gmail.com
@date:
Dic...
In [94]: import itertools
In [93]: from fractions import Fraction
In [74]: fracciones = [Fraction(31,30), Fraction(32,15),...
Out [77]: [(Fraction(31, 30), Fraction(32, 15), Fraction(97, 30), Fraction(25,

6)),
(Fraction(31,
5)),
(Fraction(31,
10))...
Upcoming SlideShare
Loading in …5
×

Usando Python en la escuela

779 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
  • Be the first to comment

  • Be the first to like this

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 []:

×