From shekay at gmail.com Sat Aug 1 01:35:43 2015 From: shekay at gmail.com (sheila miguez) Date: Fri, 31 Jul 2015 18:35:43 -0500 Subject: [Chicago] Trip Report: Django Birthday In-Reply-To: References: Message-ID: OH one thing I forgot from the talks at Django Birthday. The availability of documentation in multiple languages makes a difference -- In the discussion about the community in Mexico, django is spread very thin, and groups are stronger in areas where people are bilingual and can read English. -- sheila -------------- next part -------------- An HTML attachment was scrubbed... URL: From d-lewit at neiu.edu Mon Aug 3 03:04:02 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Sun, 2 Aug 2015 20:04:02 -0500 Subject: [Chicago] Throw those dice!!!! Message-ID: Hey guys, I will admit that I'm rather proud of this little Python program that I wrote, but for values larger than 6 either the program crashes because of a stack overflow or the program becomes really painfully SLOW! Let me explain what this program does. Let's say that you roll two dice. What are all the possible sums. If both dice land with the one-side face up, that's a sum of 2. If both dice land with the six-side face up, that is 6 + 6, which gives you a sum of 12. Then you have all the sums in between. Any student of statistics will tell you that these sums are NOT all equally probable or equally likely. For example, in the case of two dice, the most probable sum is 7 because there are several ways to get that sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} or {1, 6} or {6, 1} or ..... get the idea? But why limit ourselves to just two dice? What about three dice? Or four dice? Or five dice? Or six dice? Or any number of dice that we choose to throw? My approach works pretty well for any number of dice from 1 to 6. Beyond 6 however, that's when I run into some real problems. Is there an "easy" way to fix this? Probably not, but I thought I would check with people who are more experienced in Python than I am. I appreciate the feedback, but may not be able to reply until next weekend. I'm VERY busy this week! But still I appreciate any constructive feedback that you can provide. Many thanks, Douglas Lewit -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: RollNDice.py Type: text/x-python-script Size: 1494 bytes Desc: not available URL: From brianhray at gmail.com Mon Aug 3 03:24:27 2015 From: brianhray at gmail.com (Brian Ray) Date: Sun, 2 Aug 2015 21:24:27 -0400 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: Consider using xrange instead of range. Also, please use four spaces for the love of other developers! Concerning speed there are always two ways to do repetitive tasks: recursively and iteratively I see you are using the recursive method. Fine, but you are relying on your python stack. Similarly, thinking stacklessly (yes I invented this word and would appreciate full credit moving forward), you could conquer this same problem iteratively. If you want to drop to a more metal on metal approach, you can simply start using things like numpy. That would allow you to handle the data a little closer to the the machine. I realize you have a busy week; however, consider a couple alternative approaches outlined above. Cheers, Brian On Sun, Aug 2, 2015 at 9:04 PM, Lewit, Douglas wrote: > Hey guys, > > I will admit that I'm rather proud of this little Python program that I > wrote, but for values larger than 6 either the program crashes because of a > stack overflow or the program becomes really painfully SLOW! > > Let me explain what this program does. Let's say that you roll two dice. > What are all the possible sums. If both dice land with the one-side face > up, that's a sum of 2. If both dice land with the six-side face up, that > is 6 + 6, which gives you a sum of 12. Then you have all the sums in > between. Any student of statistics will tell you that these sums are NOT > all equally probable or equally likely. For example, in the case of two > dice, the most probable sum is 7 because there are several ways to get that > sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} > or {1, 6} or {6, 1} or ..... get the idea? > > But why limit ourselves to just two dice? What about three dice? Or four > dice? Or five dice? Or six dice? Or any number of dice that we choose to > throw? > > My approach works pretty well for any number of dice from 1 to 6. Beyond > 6 however, that's when I run into some real problems. > > Is there an "easy" way to fix this? Probably not, but I thought I would > check with people who are more experienced in Python than I am. > > I appreciate the feedback, but may not be able to reply until next > weekend. I'm VERY busy this week! But still I appreciate any constructive > feedback that you can provide. > > Many thanks, > > Douglas Lewit > > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -- Brian Ray @brianray (773) 669-7717 -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Mon Aug 3 03:16:47 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Mon, 03 Aug 2015 01:16:47 +0000 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: Dear Lewitt, What is the expected value of two die rolls? Also, given N dice rolls could I create a compression algorithm for those dice rolls? Sincerely, Joshua Herman On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas wrote: > Hey guys, > > I will admit that I'm rather proud of this little Python program that I > wrote, but for values larger than 6 either the program crashes because of a > stack overflow or the program becomes really painfully SLOW! > > Let me explain what this program does. Let's say that you roll two dice. > What are all the possible sums. If both dice land with the one-side face > up, that's a sum of 2. If both dice land with the six-side face up, that > is 6 + 6, which gives you a sum of 12. Then you have all the sums in > between. Any student of statistics will tell you that these sums are NOT > all equally probable or equally likely. For example, in the case of two > dice, the most probable sum is 7 because there are several ways to get that > sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} > or {1, 6} or {6, 1} or ..... get the idea? > > But why limit ourselves to just two dice? What about three dice? Or four > dice? Or five dice? Or six dice? Or any number of dice that we choose to > throw? > > My approach works pretty well for any number of dice from 1 to 6. Beyond > 6 however, that's when I run into some real problems. > > Is there an "easy" way to fix this? Probably not, but I thought I would > check with people who are more experienced in Python than I am. > > I appreciate the feedback, but may not be able to reply until next > weekend. I'm VERY busy this week! But still I appreciate any constructive > feedback that you can provide. > > Many thanks, > > Douglas Lewit > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lane at strapr.com Mon Aug 3 04:21:02 2015 From: lane at strapr.com (Lane Campbell) Date: Sun, 2 Aug 2015 21:21:02 -0500 Subject: [Chicago] Django MVC Diagram Message-ID: Everyone, I found this online sometime in the last year. I can't remember exactly where I discovered it. Today at the Django Study Group there was a student that found it helpful so I thought I would share it with the group. Hope to see more of you on Sunday at the next Django Study Group. ? Regards, Lane Campbell (312) 775-2632 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mtv.png Type: image/png Size: 145528 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mtv.png Type: image/png Size: 145528 bytes Desc: not available URL: From d-lewit at neiu.edu Mon Aug 3 05:30:37 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Sun, 2 Aug 2015 22:30:37 -0500 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: Hey Brian, Thanks for the feedback. A couple questions. Why is xrange better than range? Also, how would numpy help to speed things up? The reason I like the recursive approach is because without it I would end up using multiple nested for-loops, and those for-loops could quickly get out of control. For example, if I want to roll four dice, then I've got: fourDiceSums = [ ] for i in range(1, 7): for j in range(1, 7): for k in range(1, 7): for m in range(1, 7): fourDiceSums.append(i + j + k + m) Now imagine what that nested for-loop is going to look like if I decide to throw 10 or 20 or 30 dice!!! The code will become painfully unreadable and very difficult to edit at some point in the future. So there must be another way, a better way. There might be a way to give the stack a helping hand, but I'm not sure how to implement it. There's something called "memoization", which I believe is sort of a compromise between recursion and iteration. It's a way to help the recursive process so that previously computed values don't have to be re-computed. This is supposed to greatly speed up the recursion, and it also helps to make the stack smaller and more manageable. *That's all well and good*, but how would I apply memoization to this problem? Thanks guys, Douglas. On Sun, Aug 2, 2015 at 8:24 PM, Brian Ray wrote: > > > Consider using xrange instead of range. Also, please use four spaces for > the love of other developers! > > Concerning speed there are always two ways to do repetitive tasks: > recursively and iteratively > > I see you are using the recursive method. Fine, but you are relying on > your python stack. Similarly, thinking stacklessly (yes I invented this > word and would appreciate full credit moving forward), you could conquer > this same problem iteratively. If you want to drop to a more metal on > metal approach, you can simply start using things like numpy. That would > allow you to handle the data a little closer to the the machine. > > I realize you have a busy week; however, consider a couple alternative > approaches outlined above. > > Cheers, Brian > > > > On Sun, Aug 2, 2015 at 9:04 PM, Lewit, Douglas wrote: > >> Hey guys, >> >> I will admit that I'm rather proud of this little Python program that I >> wrote, but for values larger than 6 either the program crashes because of a >> stack overflow or the program becomes really painfully SLOW! >> >> Let me explain what this program does. Let's say that you roll two >> dice. What are all the possible sums. If both dice land with the one-side >> face up, that's a sum of 2. If both dice land with the six-side face up, >> that is 6 + 6, which gives you a sum of 12. Then you have all the sums in >> between. Any student of statistics will tell you that these sums are NOT >> all equally probable or equally likely. For example, in the case of two >> dice, the most probable sum is 7 because there are several ways to get that >> sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} >> or {1, 6} or {6, 1} or ..... get the idea? >> >> But why limit ourselves to just two dice? What about three dice? Or >> four dice? Or five dice? Or six dice? Or any number of dice that we >> choose to throw? >> >> My approach works pretty well for any number of dice from 1 to 6. Beyond >> 6 however, that's when I run into some real problems. >> >> Is there an "easy" way to fix this? Probably not, but I thought I would >> check with people who are more experienced in Python than I am. >> >> I appreciate the feedback, but may not be able to reply until next >> weekend. I'm VERY busy this week! But still I appreciate any constructive >> feedback that you can provide. >> >> Many thanks, >> >> Douglas Lewit >> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > > > -- > Brian Ray > @brianray > (773) 669-7717 > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at adamforsyth.net Mon Aug 3 05:37:51 2015 From: adam at adamforsyth.net (Adam Forsyth) Date: Sun, 2 Aug 2015 22:37:51 -0500 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: Douglas, Using your algorithm -- generating all possible rolls -- but a different implementation, the best I was able to do was calculate the frequencies for 11 dice in a couple of minutes. So there is no way the naive algorithm can handle large numbers of dice. If you're looking to speed yours up, I suggest you work on writing your own version of the built-in itertools.product, as this is at least the second problem you've posted to the list where that would have come in handy. Using a different algorithm, I was able to calculate the frequencies for 1000+ dice in just a few seconds (though there is a bug in my code causing the answers to be wrong for more than ~20 dice). Calculating the frequencies is the same as calculating the coefficients for the expansion of the polynomial: (x**6 + x ** 5 + .... x ** 2 + x + 1) ** n where n is the number of dice. While this is complicated, doing it for two sided dice is simple -- you're using the binomial theorem , and the coefficients for a given n are the nth row of Pascal's Triangle . I found a paper that gives the formula we need to do this for n-sided dice instead of two-sided dice -- property 6 given in section 2.1.2. I've put my work in a gist . *I'll buy lunch for anyone who can correct the mistake in my code.* Adam On Sun, Aug 2, 2015 at 8:16 PM, Joshua Herman wrote: > Dear Lewitt, > What is the expected value of two die rolls? Also, given N dice rolls > could I create a compression algorithm for those dice rolls? > Sincerely, > Joshua Herman > > On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas wrote: > >> Hey guys, >> >> I will admit that I'm rather proud of this little Python program that I >> wrote, but for values larger than 6 either the program crashes because of a >> stack overflow or the program becomes really painfully SLOW! >> >> Let me explain what this program does. Let's say that you roll two >> dice. What are all the possible sums. If both dice land with the one-side >> face up, that's a sum of 2. If both dice land with the six-side face up, >> that is 6 + 6, which gives you a sum of 12. Then you have all the sums in >> between. Any student of statistics will tell you that these sums are NOT >> all equally probable or equally likely. For example, in the case of two >> dice, the most probable sum is 7 because there are several ways to get that >> sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} >> or {1, 6} or {6, 1} or ..... get the idea? >> >> But why limit ourselves to just two dice? What about three dice? Or >> four dice? Or five dice? Or six dice? Or any number of dice that we >> choose to throw? >> >> My approach works pretty well for any number of dice from 1 to 6. Beyond >> 6 however, that's when I run into some real problems. >> >> Is there an "easy" way to fix this? Probably not, but I thought I would >> check with people who are more experienced in Python than I am. >> >> I appreciate the feedback, but may not be able to reply until next >> weekend. I'm VERY busy this week! But still I appreciate any constructive >> feedback that you can provide. >> >> Many thanks, >> >> Douglas Lewit >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From d-lewit at neiu.edu Mon Aug 3 05:38:33 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Sun, 2 Aug 2015 22:38:33 -0500 Subject: [Chicago] Django MVC Diagram In-Reply-To: References: Message-ID: Hey there Lane, I must be very badly out of touch. How often is the Django Study Group, where is it, and how much does it cost? I know very little about Django except that it is for Python what Rails is for Ruby. Can Django do whatever HTML and JavaScript can do? Sorry if these are dumb questions, but to date I haven't done any web programming. ( I should probably change that in the near future! ) Thanks Lane for the information. Best, Douglas Lewit On Sun, Aug 2, 2015 at 9:21 PM, Lane Campbell wrote: > Everyone, > > I found this online sometime in the last year. I can't remember exactly > where I discovered it. > > Today at the Django Study Group there was a student that found it helpful > so I thought I would share it with the group. Hope to see more of you on > Sunday at the next Django Study Group. > > > ? > > Regards, > Lane Campbell > (312) 775-2632 > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mtv.png Type: image/png Size: 145528 bytes Desc: not available URL: From randy7771026 at gmail.com Mon Aug 3 16:54:13 2015 From: randy7771026 at gmail.com (Randy Baxley) Date: Mon, 3 Aug 2015 09:54:13 -0500 Subject: [Chicago] Python in Processing 2.2.1 Message-ID: Too early to know what this means or if it works well but noticed it is available when I downloaded Processing for: https://class.coursera.org/digitalmedia-003/lecture which is taught using javascript -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at adamforsyth.net Mon Aug 3 21:00:21 2015 From: adam at adamforsyth.net (Adam Forsyth) Date: Mon, 3 Aug 2015 14:00:21 -0500 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: The bug has been spotted and fixed (off-list reply)! I updated the gist . (range(m) replaced with range(max(m, k)).) The fixed algorithm is still fast enough to handle 1000 dice in about six minutes on my laptop. Adam On Sun, Aug 2, 2015 at 10:37 PM, Adam Forsyth wrote: > Douglas, > > Using your algorithm -- generating all possible rolls -- but a different > implementation, the best I was able to do was calculate the frequencies for > 11 dice in a couple of minutes. So there is no way the naive algorithm can > handle large numbers of dice. If you're looking to speed yours up, I > suggest you work on writing your own version of the built-in > itertools.product, as this is at least the second problem you've posted to > the list where that would have come in handy. > > Using a different algorithm, I was able to calculate the frequencies for > 1000+ dice in just a few seconds (though there is a bug in my code causing > the answers to be wrong for more than ~20 dice). Calculating the > frequencies is the same as calculating the coefficients for the expansion > of the polynomial: > > (x**6 + x ** 5 + .... x ** 2 + x + 1) ** n > > where n is the number of dice. While this is complicated, doing it for two > sided dice is simple -- you're using the binomial theorem > , and the coefficients > for a given n are > the nth row of Pascal's Triangle > . I found a paper > > that gives the formula we need to do this for n-sided dice instead of > two-sided dice -- property 6 given in section 2.1.2. > > I've put my work in a gist > . > > *I'll buy lunch for anyone who can correct the mistake in my code.* > Adam > > > > On Sun, Aug 2, 2015 at 8:16 PM, Joshua Herman > wrote: > >> Dear Lewitt, >> What is the expected value of two die rolls? Also, given N dice rolls >> could I create a compression algorithm for those dice rolls? >> Sincerely, >> Joshua Herman >> >> On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas wrote: >> >>> Hey guys, >>> >>> I will admit that I'm rather proud of this little Python program that I >>> wrote, but for values larger than 6 either the program crashes because of a >>> stack overflow or the program becomes really painfully SLOW! >>> >>> Let me explain what this program does. Let's say that you roll two >>> dice. What are all the possible sums. If both dice land with the one-side >>> face up, that's a sum of 2. If both dice land with the six-side face up, >>> that is 6 + 6, which gives you a sum of 12. Then you have all the sums in >>> between. Any student of statistics will tell you that these sums are NOT >>> all equally probable or equally likely. For example, in the case of two >>> dice, the most probable sum is 7 because there are several ways to get that >>> sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} >>> or {1, 6} or {6, 1} or ..... get the idea? >>> >>> But why limit ourselves to just two dice? What about three dice? Or >>> four dice? Or five dice? Or six dice? Or any number of dice that we >>> choose to throw? >>> >>> My approach works pretty well for any number of dice from 1 to 6. >>> Beyond 6 however, that's when I run into some real problems. >>> >>> Is there an "easy" way to fix this? Probably not, but I thought I would >>> check with people who are more experienced in Python than I am. >>> >>> I appreciate the feedback, but may not be able to reply until next >>> weekend. I'm VERY busy this week! But still I appreciate any constructive >>> feedback that you can provide. >>> >>> Many thanks, >>> >>> Douglas Lewit >>> >>> _______________________________________________ >>> Chicago mailing list >>> Chicago at python.org >>> https://mail.python.org/mailman/listinfo/chicago >>> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lane at strapr.com Mon Aug 3 22:31:46 2015 From: lane at strapr.com (Lane Campbell) Date: Mon, 3 Aug 2015 15:31:46 -0500 Subject: [Chicago] Django MVC Diagram In-Reply-To: References: Message-ID: <8721485716560930588@unknownmsgid> Douglas, It's a free, informal study group I host weekly out in Lincoln Park to help people set aside time to work together on projects. I'm using it to learn Django and I'm actually impressed with how much people are learning. Myself included. This week I even helped someone through the Django tutorial. I still suck at Python but I'm comfortable with how the framework works now. Sign up on the chipy meetup group and stop in! Sent from my iPhone On Aug 3, 2015, at 6:43 AM, Lewit, Douglas wrote: Hey there Lane, I must be very badly out of touch. How often is the Django Study Group, where is it, and how much does it cost? I know very little about Django except that it is for Python what Rails is for Ruby. Can Django do whatever HTML and JavaScript can do? Sorry if these are dumb questions, but to date I haven't done any web programming. ( I should probably change that in the near future! ) Thanks Lane for the information. Best, Douglas Lewit On Sun, Aug 2, 2015 at 9:21 PM, Lane Campbell wrote: > Everyone, > > I found this online sometime in the last year. I can't remember exactly > where I discovered it. > > Today at the Django Study Group there was a student that found it helpful > so I thought I would share it with the group. Hope to see more of you on > Sunday at the next Django Study Group. > > > ? > > Regards, > Lane Campbell > (312) 775-2632 > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > _______________________________________________ Chicago mailing list Chicago at python.org https://mail.python.org/mailman/listinfo/chicago -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mtv.png Type: image/png Size: 145528 bytes Desc: not available URL: From kenschutte at gmail.com Tue Aug 4 05:11:50 2015 From: kenschutte at gmail.com (Ken Schutte) Date: Mon, 3 Aug 2015 22:11:50 -0500 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: Note that you can solve this iteratively - which I think is easier and is much more efficient (at least in the cases where you want to compute the full distribution of possible sums): I tried it here, https://gist.github.com/kts/65d71c761baa9714151c I haven't fully tested it, but try running "$ time python multcoeff.py 6 1000 > out". which takes ~2.5sec on my little chromebook. It outputs the counts for all possible values, in this case they correspond to sums 1000, 1001, ..., 5999, 6000. The binomial coefficients can be computed in Pascal's triangle by simply sweeping across and adding two numbers from the row above. Here, it is similar, but you just have to add 6 numbers from the row above for each value. I think this is a nice example of "dynamic programming" - where an optimal solution depends upon a lot of highly overlapping sub-problems. For example - how many ways can 100 dice add up to the value of 307? That is complicated, BUT if you know the distribution for 99 dice, it is trivial - you only have to know the counts for values 301,302,...,306 because those are the only sums of 99 dice that influence the question at hand. And that's what this code does (and how one computes values in Pascal's triangle). A side note for anyone familiar with convolution - each level in computing such a triangle is really a convolution with all ones - for example K=6 sided die is a convolution with [1,1,1,1,1,1]. Which makes you wonder if you can use fast (FFT, N log N) convolutions for such a problem - I would guess no in this case. Ken On Mon, Aug 3, 2015 at 2:00 PM, Adam Forsyth wrote: > The bug has been spotted and fixed (off-list reply)! I updated the gist > . (range(m) replaced > with range(max(m, k)).) The fixed algorithm is still fast enough to handle > 1000 dice in about six minutes on my laptop. > > Adam > > On Sun, Aug 2, 2015 at 10:37 PM, Adam Forsyth > wrote: > >> Douglas, >> >> Using your algorithm -- generating all possible rolls -- but a different >> implementation, the best I was able to do was calculate the frequencies for >> 11 dice in a couple of minutes. So there is no way the naive algorithm can >> handle large numbers of dice. If you're looking to speed yours up, I >> suggest you work on writing your own version of the built-in >> itertools.product, as this is at least the second problem you've posted to >> the list where that would have come in handy. >> >> Using a different algorithm, I was able to calculate the frequencies for >> 1000+ dice in just a few seconds (though there is a bug in my code causing >> the answers to be wrong for more than ~20 dice). Calculating the >> frequencies is the same as calculating the coefficients for the expansion >> of the polynomial: >> >> (x**6 + x ** 5 + .... x ** 2 + x + 1) ** n >> >> where n is the number of dice. While this is complicated, doing it for >> two sided dice is simple -- you're using the binomial theorem >> , and the coefficients >> for a given n are >> the nth row of Pascal's Triangle >> . I found a paper >> >> that gives the formula we need to do this for n-sided dice instead of >> two-sided dice -- property 6 given in section 2.1.2. >> >> I've put my work in a gist >> . >> >> *I'll buy lunch for anyone who can correct the mistake in my code.* >> Adam >> >> >> >> On Sun, Aug 2, 2015 at 8:16 PM, Joshua Herman >> wrote: >> >>> Dear Lewitt, >>> What is the expected value of two die rolls? Also, given N dice rolls >>> could I create a compression algorithm for those dice rolls? >>> Sincerely, >>> Joshua Herman >>> >>> On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas wrote: >>> >>>> Hey guys, >>>> >>>> I will admit that I'm rather proud of this little Python program that I >>>> wrote, but for values larger than 6 either the program crashes because of a >>>> stack overflow or the program becomes really painfully SLOW! >>>> >>>> Let me explain what this program does. Let's say that you roll two >>>> dice. What are all the possible sums. If both dice land with the one-side >>>> face up, that's a sum of 2. If both dice land with the six-side face up, >>>> that is 6 + 6, which gives you a sum of 12. Then you have all the sums in >>>> between. Any student of statistics will tell you that these sums are NOT >>>> all equally probable or equally likely. For example, in the case of two >>>> dice, the most probable sum is 7 because there are several ways to get that >>>> sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} >>>> or {1, 6} or {6, 1} or ..... get the idea? >>>> >>>> But why limit ourselves to just two dice? What about three dice? Or >>>> four dice? Or five dice? Or six dice? Or any number of dice that we >>>> choose to throw? >>>> >>>> My approach works pretty well for any number of dice from 1 to 6. >>>> Beyond 6 however, that's when I run into some real problems. >>>> >>>> Is there an "easy" way to fix this? Probably not, but I thought I >>>> would check with people who are more experienced in Python than I am. >>>> >>>> I appreciate the feedback, but may not be able to reply until next >>>> weekend. I'm VERY busy this week! But still I appreciate any constructive >>>> feedback that you can provide. >>>> >>>> Many thanks, >>>> >>>> Douglas Lewit >>>> >>>> _______________________________________________ >>>> Chicago mailing list >>>> Chicago at python.org >>>> https://mail.python.org/mailman/listinfo/chicago >>>> >>> >>> _______________________________________________ >>> Chicago mailing list >>> Chicago at python.org >>> https://mail.python.org/mailman/listinfo/chicago >>> >>> >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From MDiPierro at cs.depaul.edu Tue Aug 4 07:23:29 2015 From: MDiPierro at cs.depaul.edu (DiPierro, Massimo) Date: Tue, 4 Aug 2015 05:23:29 +0000 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: <01A41949-8D1E-4FA3-A497-F17C61982706@cs.depaul.edu> If you need a specific row of the triangle this is as fast as it gets: def pascal_row(n,k): a = b = 1 for i in range(k,n): a=a*i for i in range(1,n-k): b=b*i return a/b def print_triangle(n_max=10): for n in range(1,n_max+1): for k in range(0,n+1): print pascal_row(n,k), print print_triangle() On Aug 3, 2015, at 10:11 PM, Ken Schutte > wrote: Note that you can solve this iteratively - which I think is easier and is much more efficient (at least in the cases where you want to compute the full distribution of possible sums): I tried it here, https://gist.github.com/kts/65d71c761baa9714151c I haven't fully tested it, but try running "$ time python multcoeff.py 6 1000 > out". which takes ~2.5sec on my little chromebook. It outputs the counts for all possible values, in this case they correspond to sums 1000, 1001, ..., 5999, 6000. The binomial coefficients can be computed in Pascal's triangle by simply sweeping across and adding two numbers from the row above. Here, it is similar, but you just have to add 6 numbers from the row above for each value. I think this is a nice example of "dynamic programming" - where an optimal solution depends upon a lot of highly overlapping sub-problems. For example - how many ways can 100 dice add up to the value of 307? That is complicated, BUT if you know the distribution for 99 dice, it is trivial - you only have to know the counts for values 301,302,...,306 because those are the only sums of 99 dice that influence the question at hand. And that's what this code does (and how one computes values in Pascal's triangle). A side note for anyone familiar with convolution - each level in computing such a triangle is really a convolution with all ones - for example K=6 sided die is a convolution with [1,1,1,1,1,1]. Which makes you wonder if you can use fast (FFT, N log N) convolutions for such a problem - I would guess no in this case. Ken On Mon, Aug 3, 2015 at 2:00 PM, Adam Forsyth > wrote: The bug has been spotted and fixed (off-list reply)! I updated the gist. (range(m) replaced with range(max(m, k)).) The fixed algorithm is still fast enough to handle 1000 dice in about six minutes on my laptop. Adam On Sun, Aug 2, 2015 at 10:37 PM, Adam Forsyth > wrote: Douglas, Using your algorithm -- generating all possible rolls -- but a different implementation, the best I was able to do was calculate the frequencies for 11 dice in a couple of minutes. So there is no way the naive algorithm can handle large numbers of dice. If you're looking to speed yours up, I suggest you work on writing your own version of the built-in itertools.product, as this is at least the second problem you've posted to the list where that would have come in handy. Using a different algorithm, I was able to calculate the frequencies for 1000+ dice in just a few seconds (though there is a bug in my code causing the answers to be wrong for more than ~20 dice). Calculating the frequencies is the same as calculating the coefficients for the expansion of the polynomial: (x**6 + x ** 5 + .... x ** 2 + x + 1) ** n where n is the number of dice. While this is complicated, doing it for two sided dice is simple -- you're using the binomial theorem, and the coefficients for a given n are the nth row of Pascal's Triangle. I found a paper that gives the formula we need to do this for n-sided dice instead of two-sided dice -- property 6 given in section 2.1.2. I've put my work in a gist. I'll buy lunch for anyone who can correct the mistake in my code. Adam On Sun, Aug 2, 2015 at 8:16 PM, Joshua Herman > wrote: Dear Lewitt, What is the expected value of two die rolls? Also, given N dice rolls could I create a compression algorithm for those dice rolls? Sincerely, Joshua Herman On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas > wrote: Hey guys, I will admit that I'm rather proud of this little Python program that I wrote, but for values larger than 6 either the program crashes because of a stack overflow or the program becomes really painfully SLOW! Let me explain what this program does. Let's say that you roll two dice. What are all the possible sums. If both dice land with the one-side face up, that's a sum of 2. If both dice land with the six-side face up, that is 6 + 6, which gives you a sum of 12. Then you have all the sums in between. Any student of statistics will tell you that these sums are NOT all equally probable or equally likely. For example, in the case of two dice, the most probable sum is 7 because there are several ways to get that sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} or {1, 6} or {6, 1} or ..... get the idea? But why limit ourselves to just two dice? What about three dice? Or four dice? Or five dice? Or six dice? Or any number of dice that we choose to throw? My approach works pretty well for any number of dice from 1 to 6. Beyond 6 however, that's when I run into some real problems. Is there an "easy" way to fix this? Probably not, but I thought I would check with people who are more experienced in Python than I am. I appreciate the feedback, but may not be able to reply until next weekend. I'm VERY busy this week! But still I appreciate any constructive feedback that you can provide. Many thanks, Douglas Lewit _______________________________________________ Chicago mailing list Chicago at python.org https://mail.python.org/mailman/listinfo/chicago _______________________________________________ Chicago mailing list Chicago at python.org https://mail.python.org/mailman/listinfo/chicago _______________________________________________ Chicago mailing list Chicago at python.org https://mail.python.org/mailman/listinfo/chicago _______________________________________________ Chicago mailing list Chicago at python.org https://mail.python.org/mailman/listinfo/chicago From MDiPierro at cs.depaul.edu Tue Aug 4 07:30:01 2015 From: MDiPierro at cs.depaul.edu (DiPierro, Massimo) Date: Tue, 4 Aug 2015 05:30:01 +0000 Subject: [Chicago] Throw those dice!!!! In-Reply-To: <01A41949-8D1E-4FA3-A497-F17C61982706@cs.depaul.edu> References: <01A41949-8D1E-4FA3-A497-F17C61982706@cs.depaul.edu> Message-ID: <03C74CB7-CE21-450C-9198-C981D58AFA36@cs.depaul.edu> Sorry I misread the problem. This was only for a 2 dice or a coin. Ignore me. On Aug 4, 2015, at 12:23 AM, DiPierro, Massimo wrote: > If you need a specific row of the triangle this is as fast as it gets: > > def pascal_row(n,k): > a = b = 1 > for i in range(k,n): a=a*i > for i in range(1,n-k): b=b*i > return a/b > > > def print_triangle(n_max=10): > for n in range(1,n_max+1): > for k in range(0,n+1): > print pascal_row(n,k), > print > > print_triangle() > > On Aug 3, 2015, at 10:11 PM, Ken Schutte > wrote: > > Note that you can solve this iteratively - which I think is easier and is much more efficient (at least in the cases where you want to compute the full distribution of possible sums): > > I tried it here, https://gist.github.com/kts/65d71c761baa9714151c > > I haven't fully tested it, but try running "$ time python multcoeff.py 6 1000 > out". which takes ~2.5sec on my little chromebook. It outputs the counts for all possible values, in this case they correspond to sums 1000, 1001, ..., 5999, 6000. > > The binomial coefficients can be computed in Pascal's triangle by simply sweeping across and adding two numbers from the row above. Here, it is similar, but you just have to add 6 numbers from the row above for each value. > > I think this is a nice example of "dynamic programming" - where an optimal solution depends upon a lot of highly overlapping sub-problems. For example - how many ways can 100 dice add up to the value of 307? That is complicated, BUT if you know the distribution for 99 dice, it is trivial - you only have to know the counts for values 301,302,...,306 because those are the only sums of 99 dice that influence the question at hand. And that's what this code does (and how one computes values in Pascal's triangle). > > A side note for anyone familiar with convolution - each level in computing such a triangle is really a convolution with all ones - for example K=6 sided die is a convolution with [1,1,1,1,1,1]. Which makes you wonder if you can use fast (FFT, N log N) convolutions for such a problem - I would guess no in this case. > > Ken > > > On Mon, Aug 3, 2015 at 2:00 PM, Adam Forsyth > wrote: > The bug has been spotted and fixed (off-list reply)! I updated the gist. (range(m) replaced with range(max(m, k)).) The fixed algorithm is still fast enough to handle 1000 dice in about six minutes on my laptop. > > Adam > > On Sun, Aug 2, 2015 at 10:37 PM, Adam Forsyth > wrote: > Douglas, > > Using your algorithm -- generating all possible rolls -- but a different implementation, the best I was able to do was calculate the frequencies for 11 dice in a couple of minutes. So there is no way the naive algorithm can handle large numbers of dice. If you're looking to speed yours up, I suggest you work on writing your own version of the built-in itertools.product, as this is at least the second problem you've posted to the list where that would have come in handy. > > Using a different algorithm, I was able to calculate the frequencies for 1000+ dice in just a few seconds (though there is a bug in my code causing the answers to be wrong for more than ~20 dice). Calculating the frequencies is the same as calculating the coefficients for the expansion of the polynomial: > > (x**6 + x ** 5 + .... x ** 2 + x + 1) ** n > > where n is the number of dice. While this is complicated, doing it for two sided dice is simple -- you're using the binomial theorem, and the coefficients for a given n are the nth row of Pascal's Triangle. I found a paper that gives the formula we need to do this for n-sided dice instead of two-sided dice -- property 6 given in section 2.1.2. > > I've put my work in a gist. I'll buy lunch for anyone who can correct the mistake in my code. > > Adam > > > > On Sun, Aug 2, 2015 at 8:16 PM, Joshua Herman > wrote: > Dear Lewitt, > What is the expected value of two die rolls? Also, given N dice rolls could I create a compression algorithm for those dice rolls? > Sincerely, > Joshua Herman > > On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas > wrote: > Hey guys, > > I will admit that I'm rather proud of this little Python program that I wrote, but for values larger than 6 either the program crashes because of a stack overflow or the program becomes really painfully SLOW! > > Let me explain what this program does. Let's say that you roll two dice. What are all the possible sums. If both dice land with the one-side face up, that's a sum of 2. If both dice land with the six-side face up, that is 6 + 6, which gives you a sum of 12. Then you have all the sums in between. Any student of statistics will tell you that these sums are NOT all equally probable or equally likely. For example, in the case of two dice, the most probable sum is 7 because there are several ways to get that sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} or {1, 6} or {6, 1} or ..... get the idea? > > But why limit ourselves to just two dice? What about three dice? Or four dice? Or five dice? Or six dice? Or any number of dice that we choose to throw? > > My approach works pretty well for any number of dice from 1 to 6. Beyond 6 however, that's when I run into some real problems. > > Is there an "easy" way to fix this? Probably not, but I thought I would check with people who are more experienced in Python than I am. > > I appreciate the feedback, but may not be able to reply until next weekend. I'm VERY busy this week! But still I appreciate any constructive feedback that you can provide. > > Many thanks, > > Douglas Lewit > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > > > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago From d-lewit at neiu.edu Tue Aug 4 09:14:37 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Tue, 4 Aug 2015 02:14:37 -0500 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: Hi Joshua, The expected value for two dice is going to be 7. That makes sense because there are 5 or 6 ways to create the sum of 7 with two dice, while all other sums will have fewer frequencies. Obviously as you start rolling more and more dice, the expected value will change. If you are rolling 8 dice, a sum of 7 isn't even possible! (Cause if you get 1's on all 8 dice, then your minimum possible sum has to be 8, right?) Using Mathematica and also Matplotlib I generated several histograms for these problems. Based on my observations, these frequency distributions appear normally distributed. I took an intro C++ course at Oakton College a couple years back. The professor used to live in Las Vegas and really LOVED casino mathematics, probability, statistics and writing programs to simulate games of chance. It was just an intro course, so we didn't get into a lot of hardcore stuff, but it was sure interesting. As a side note, C++ can be a strange language! I loved writing C++ programs on my Mac, but was very disappointed to discover that most of my C++ programs that ran on my Mac definitely did not run properly or even compile on the Windows and Linux computers at the college. Then I discovered the reason. There are different flavors of C/C++ depending on which operating system you use. Apple has its own version of C/C++, which is slightly different from the GNU version of C/C++. How confusing! What I like about Java, Python, Ruby, etc, is that these newer languages are basically "one size fits all" or "one universal compiler/interpreter for all operating systems". I'm pretty sure that's why Java eventually replaced C/C++ as the "king" of object-oriented programming languages. Java has the advantage of platform-independence. The same with Python, right? On Sun, Aug 2, 2015 at 8:16 PM, Joshua Herman wrote: > Dear Lewitt, > What is the expected value of two die rolls? Also, given N dice rolls > could I create a compression algorithm for those dice rolls? > Sincerely, > Joshua Herman > > On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas wrote: > >> Hey guys, >> >> I will admit that I'm rather proud of this little Python program that I >> wrote, but for values larger than 6 either the program crashes because of a >> stack overflow or the program becomes really painfully SLOW! >> >> Let me explain what this program does. Let's say that you roll two >> dice. What are all the possible sums. If both dice land with the one-side >> face up, that's a sum of 2. If both dice land with the six-side face up, >> that is 6 + 6, which gives you a sum of 12. Then you have all the sums in >> between. Any student of statistics will tell you that these sums are NOT >> all equally probable or equally likely. For example, in the case of two >> dice, the most probable sum is 7 because there are several ways to get that >> sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} >> or {1, 6} or {6, 1} or ..... get the idea? >> >> But why limit ourselves to just two dice? What about three dice? Or >> four dice? Or five dice? Or six dice? Or any number of dice that we >> choose to throw? >> >> My approach works pretty well for any number of dice from 1 to 6. Beyond >> 6 however, that's when I run into some real problems. >> >> Is there an "easy" way to fix this? Probably not, but I thought I would >> check with people who are more experienced in Python than I am. >> >> I appreciate the feedback, but may not be able to reply until next >> weekend. I'm VERY busy this week! But still I appreciate any constructive >> feedback that you can provide. >> >> Many thanks, >> >> Douglas Lewit >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at adamforsyth.net Wed Aug 5 21:54:15 2015 From: adam at adamforsyth.net (Adam Forsyth) Date: Wed, 5 Aug 2015 14:54:15 -0500 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: Ken, you're right, that way is much faster if you're calculating all of the frequencies. The method I used is actually for calculating a single frequency (a single coefficient of the expanded polynomial) and so wastes a lot of calculations if you use it for all of the frequencies individually. On Mon, Aug 3, 2015 at 10:11 PM, Ken Schutte wrote: > Note that you can solve this iteratively - which I think is easier and is > much more efficient (at least in the cases where you want to compute the > full distribution of possible sums): > > I tried it here, https://gist.github.com/kts/65d71c761baa9714151c > > I haven't fully tested it, but try running "$ time python multcoeff.py 6 > 1000 > out". which takes ~2.5sec on my little chromebook. It outputs the > counts for all possible values, in this case they correspond to sums 1000, > 1001, ..., 5999, 6000. > > The binomial coefficients can be computed in Pascal's triangle by simply > sweeping across and adding two numbers from the row above. Here, it is > similar, but you just have to add 6 numbers from the row above for each > value. > > I think this is a nice example of "dynamic programming" - where an optimal > solution depends upon a lot of highly overlapping sub-problems. For > example - how many ways can 100 dice add up to the value of 307? That is > complicated, BUT if you know the distribution for 99 dice, it is trivial - > you only have to know the counts for values 301,302,...,306 because those > are the only sums of 99 dice that influence the question at hand. And > that's what this code does (and how one computes values in Pascal's > triangle). > > A side note for anyone familiar with convolution - each level in computing > such a triangle is really a convolution with all ones - for example K=6 > sided die is a convolution with [1,1,1,1,1,1]. Which makes you wonder if > you can use fast (FFT, N log N) convolutions for such a problem - I would > guess no in this case. > > Ken > > > On Mon, Aug 3, 2015 at 2:00 PM, Adam Forsyth wrote: > >> The bug has been spotted and fixed (off-list reply)! I updated the gist >> . (range(m) replaced >> with range(max(m, k)).) The fixed algorithm is still fast enough to handle >> 1000 dice in about six minutes on my laptop. >> >> Adam >> >> On Sun, Aug 2, 2015 at 10:37 PM, Adam Forsyth >> wrote: >> >>> Douglas, >>> >>> Using your algorithm -- generating all possible rolls -- but a different >>> implementation, the best I was able to do was calculate the frequencies for >>> 11 dice in a couple of minutes. So there is no way the naive algorithm can >>> handle large numbers of dice. If you're looking to speed yours up, I >>> suggest you work on writing your own version of the built-in >>> itertools.product, as this is at least the second problem you've posted to >>> the list where that would have come in handy. >>> >>> Using a different algorithm, I was able to calculate the frequencies for >>> 1000+ dice in just a few seconds (though there is a bug in my code causing >>> the answers to be wrong for more than ~20 dice). Calculating the >>> frequencies is the same as calculating the coefficients for the expansion >>> of the polynomial: >>> >>> (x**6 + x ** 5 + .... x ** 2 + x + 1) ** n >>> >>> where n is the number of dice. While this is complicated, doing it for >>> two sided dice is simple -- you're using the binomial theorem >>> , and the coefficients >>> for a given n are >>> the nth row of Pascal's Triangle >>> . I found a paper >>> >>> that gives the formula we need to do this for n-sided dice instead of >>> two-sided dice -- property 6 given in section 2.1.2. >>> >>> I've put my work in a gist >>> . >>> >>> *I'll buy lunch for anyone who can correct the mistake in my code.* >>> Adam >>> >>> >>> >>> On Sun, Aug 2, 2015 at 8:16 PM, Joshua Herman >>> wrote: >>> >>>> Dear Lewitt, >>>> What is the expected value of two die rolls? Also, given N dice rolls >>>> could I create a compression algorithm for those dice rolls? >>>> Sincerely, >>>> Joshua Herman >>>> >>>> On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas wrote: >>>> >>>>> Hey guys, >>>>> >>>>> I will admit that I'm rather proud of this little Python program that >>>>> I wrote, but for values larger than 6 either the program crashes because of >>>>> a stack overflow or the program becomes really painfully SLOW! >>>>> >>>>> Let me explain what this program does. Let's say that you roll two >>>>> dice. What are all the possible sums. If both dice land with the one-side >>>>> face up, that's a sum of 2. If both dice land with the six-side face up, >>>>> that is 6 + 6, which gives you a sum of 12. Then you have all the sums in >>>>> between. Any student of statistics will tell you that these sums are NOT >>>>> all equally probable or equally likely. For example, in the case of two >>>>> dice, the most probable sum is 7 because there are several ways to get that >>>>> sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} >>>>> or {1, 6} or {6, 1} or ..... get the idea? >>>>> >>>>> But why limit ourselves to just two dice? What about three dice? Or >>>>> four dice? Or five dice? Or six dice? Or any number of dice that we >>>>> choose to throw? >>>>> >>>>> My approach works pretty well for any number of dice from 1 to 6. >>>>> Beyond 6 however, that's when I run into some real problems. >>>>> >>>>> Is there an "easy" way to fix this? Probably not, but I thought I >>>>> would check with people who are more experienced in Python than I am. >>>>> >>>>> I appreciate the feedback, but may not be able to reply until next >>>>> weekend. I'm VERY busy this week! But still I appreciate any constructive >>>>> feedback that you can provide. >>>>> >>>>> Many thanks, >>>>> >>>>> Douglas Lewit >>>>> >>>>> _______________________________________________ >>>>> Chicago mailing list >>>>> Chicago at python.org >>>>> https://mail.python.org/mailman/listinfo/chicago >>>>> >>>> >>>> _______________________________________________ >>>> Chicago mailing list >>>> Chicago at python.org >>>> https://mail.python.org/mailman/listinfo/chicago >>>> >>>> >>> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Wed Aug 5 23:55:07 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Wed, 05 Aug 2015 21:55:07 +0000 Subject: [Chicago] Throw those dice!!!! In-Reply-To: References: Message-ID: All The second question I asked is an information theory question and it should have no good answer as long as your dice are fair. Sincerely Joshua Herman On Wed, Aug 5, 2015 at 2:55 PM Adam Forsyth wrote: > Ken, you're right, that way is much faster if you're calculating all of > the frequencies. The method I used is actually for calculating a single > frequency (a single coefficient of the expanded polynomial) and so wastes a > lot of calculations if you use it for all of the frequencies individually. > > On Mon, Aug 3, 2015 at 10:11 PM, Ken Schutte wrote: > >> Note that you can solve this iteratively - which I think is easier and is >> much more efficient (at least in the cases where you want to compute the >> full distribution of possible sums): >> >> I tried it here, https://gist.github.com/kts/65d71c761baa9714151c >> >> I haven't fully tested it, but try running "$ time python multcoeff.py 6 >> 1000 > out". which takes ~2.5sec on my little chromebook. It outputs the >> counts for all possible values, in this case they correspond to sums 1000, >> 1001, ..., 5999, 6000. >> >> The binomial coefficients can be computed in Pascal's triangle by simply >> sweeping across and adding two numbers from the row above. Here, it is >> similar, but you just have to add 6 numbers from the row above for each >> value. >> >> I think this is a nice example of "dynamic programming" - where an >> optimal solution depends upon a lot of highly overlapping sub-problems. >> For example - how many ways can 100 dice add up to the value of 307? That >> is complicated, BUT if you know the distribution for 99 dice, it is trivial >> - you only have to know the counts for values 301,302,...,306 because those >> are the only sums of 99 dice that influence the question at hand. And >> that's what this code does (and how one computes values in Pascal's >> triangle). >> >> A side note for anyone familiar with convolution - each level in >> computing such a triangle is really a convolution with all ones - for >> example K=6 sided die is a convolution with [1,1,1,1,1,1]. Which makes you >> wonder if you can use fast (FFT, N log N) convolutions for such a problem - >> I would guess no in this case. >> >> Ken >> >> >> On Mon, Aug 3, 2015 at 2:00 PM, Adam Forsyth >> wrote: >> >>> The bug has been spotted and fixed (off-list reply)! I updated the gist >>> . (range(m) >>> replaced with range(max(m, k)).) The fixed algorithm is still fast enough >>> to handle 1000 dice in about six minutes on my laptop. >>> >>> Adam >>> >>> On Sun, Aug 2, 2015 at 10:37 PM, Adam Forsyth >>> wrote: >>> >>>> Douglas, >>>> >>>> Using your algorithm -- generating all possible rolls -- but a >>>> different implementation, the best I was able to do was calculate the >>>> frequencies for 11 dice in a couple of minutes. So there is no way the >>>> naive algorithm can handle large numbers of dice. If you're looking to >>>> speed yours up, I suggest you work on writing your own version of the >>>> built-in itertools.product, as this is at least the second problem you've >>>> posted to the list where that would have come in handy. >>>> >>>> Using a different algorithm, I was able to calculate the frequencies >>>> for 1000+ dice in just a few seconds (though there is a bug in my code >>>> causing the answers to be wrong for more than ~20 dice). Calculating the >>>> frequencies is the same as calculating the coefficients for the expansion >>>> of the polynomial: >>>> >>>> (x**6 + x ** 5 + .... x ** 2 + x + 1) ** n >>>> >>>> where n is the number of dice. While this is complicated, doing it for >>>> two sided dice is simple -- you're using the binomial theorem >>>> , and the coefficients >>>> for a given n are >>>> the nth row of Pascal's Triangle >>>> . I found a paper >>>> >>>> that gives the formula we need to do this for n-sided dice instead of >>>> two-sided dice -- property 6 given in section 2.1.2. >>>> >>>> I've put my work in a gist >>>> . >>>> >>>> *I'll buy lunch for anyone who can correct the mistake in my code.* >>>> Adam >>>> >>>> >>>> >>>> On Sun, Aug 2, 2015 at 8:16 PM, Joshua Herman >>> > wrote: >>>> >>>>> Dear Lewitt, >>>>> What is the expected value of two die rolls? Also, given N dice rolls >>>>> could I create a compression algorithm for those dice rolls? >>>>> Sincerely, >>>>> Joshua Herman >>>>> >>>>> On Sun, Aug 2, 2015 at 8:04 PM Lewit, Douglas >>>>> wrote: >>>>> >>>>>> Hey guys, >>>>>> >>>>>> I will admit that I'm rather proud of this little Python program that >>>>>> I wrote, but for values larger than 6 either the program crashes because of >>>>>> a stack overflow or the program becomes really painfully SLOW! >>>>>> >>>>>> Let me explain what this program does. Let's say that you roll two >>>>>> dice. What are all the possible sums. If both dice land with the one-side >>>>>> face up, that's a sum of 2. If both dice land with the six-side face up, >>>>>> that is 6 + 6, which gives you a sum of 12. Then you have all the sums in >>>>>> between. Any student of statistics will tell you that these sums are NOT >>>>>> all equally probable or equally likely. For example, in the case of two >>>>>> dice, the most probable sum is 7 because there are several ways to get that >>>>>> sum. First die = 3, second die = 4, {3, 4} or {4, 3} or {5, 2} or {2, 5} >>>>>> or {1, 6} or {6, 1} or ..... get the idea? >>>>>> >>>>>> But why limit ourselves to just two dice? What about three dice? Or >>>>>> four dice? Or five dice? Or six dice? Or any number of dice that we >>>>>> choose to throw? >>>>>> >>>>>> My approach works pretty well for any number of dice from 1 to 6. >>>>>> Beyond 6 however, that's when I run into some real problems. >>>>>> >>>>>> Is there an "easy" way to fix this? Probably not, but I thought I >>>>>> would check with people who are more experienced in Python than I am. >>>>>> >>>>>> I appreciate the feedback, but may not be able to reply until next >>>>>> weekend. I'm VERY busy this week! But still I appreciate any constructive >>>>>> feedback that you can provide. >>>>>> >>>>>> Many thanks, >>>>>> >>>>>> Douglas Lewit >>>>>> >>>>>> _______________________________________________ >>>>>> Chicago mailing list >>>>>> Chicago at python.org >>>>>> https://mail.python.org/mailman/listinfo/chicago >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Chicago mailing list >>>>> Chicago at python.org >>>>> https://mail.python.org/mailman/listinfo/chicago >>>>> >>>>> >>>> >>> >>> _______________________________________________ >>> Chicago mailing list >>> Chicago at python.org >>> https://mail.python.org/mailman/listinfo/chicago >>> >>> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > -------------- next part -------------- An HTML attachment was scrubbed... URL: From d-lewit at neiu.edu Sat Aug 8 08:35:02 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Sat, 8 Aug 2015 01:35:02 -0500 Subject: [Chicago] The KnapSack problem. Message-ID: Hi guys, Here's my brute-force solution to the knapsack problem. I like it! The running time I think is O(2**n) where n is the number of items, so if you plan to stuff like 30 or more items in your knapsack then my algorithm may not provide a very fast, efficient approach! But for smaller problems the running time should not be that bad. I know somebody on the list wrote, "For the love of other developers, please use 4 spaces!" Well, I wish I could be accommodating, but.... I'm not a big fan of just 4 spaces!!! I gotta have 6 spaces at least. Don't know why! Maybe there's something wrong with my eyes, right? This was actually a problem on my Algorithms final at Northeastern. (But we had to write our code in Java, and we couldn't test it on a computer. Just our best handwritten approximation of the correct code.) Just sharing this with everyone on the list. I hope the feedback is good! If not, well.... you can't complain about the price cause it's FREE!!! LOL!!! By the way, on a totally different subject here, have you noticed that a lot of CS professors think that all their students are plagiarists, downloading all their program files from Github and StackOverflow? I gotta say that this attitude is really offensive to me because I don't steal other people's programs. I write my own! I've got a couple friends in other states with PhD's (both in mathematics) and I have heard plenty of stories about professors guilty of plagiarism, stealing work from graduate students and research assistants and then taking all the credit for it. I heard a similar story from a guy who was a graduate history major at DePaul a long time ago. He told me that some academics that he worked with at DePaul were absolutely ruthless, and thought it was perfectly okay to take credit for the work of graduate students and research assistants! I just get tired of professors who imply that their students are all a big bunch of thieves and plagiarists. I'm sure it happens, but I doubt if it happens with any great regularity. What do you think? By the way, I'm pretty sure that the famous KNAPSACK PROBLEM is really a special type of linear programming problem that has integer constraints. Linear programming is definitely pretty interesting, but some of the algorithms can get kind of rough and intimidating. But I have heard that the algorithms of linear programming and operations research in general are extremely important in business and economics. Have a fun and fabulous weekend! Kind regards, Douglas Lewit -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: KnapSack.py Type: text/x-python-script Size: 3121 bytes Desc: not available URL: From zitterbewegung at gmail.com Sat Aug 8 12:28:37 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Sat, 8 Aug 2015 05:28:37 -0500 Subject: [Chicago] The KnapSack problem. In-Reply-To: References: Message-ID: Dear Lewellit, The KNAPSACK problem is NP-complete as a decision problem and NP-hard as a optimization problem. Linear programming is NP-hard and I believe from the complexity zoo that it also is a member of the complexity class FP. I believe if you take your KNAPSCAK problem and you reduce it to a SAT solve the runtime would be much better. It would be O(1.32113n) with a sat solver that you can use below http://cstheory.stackexchange.com/a/1070/5385 Sincerely, Joshua Herman On Sat, Aug 8, 2015 at 1:35 AM, Lewit, Douglas wrote: > Hi guys, > > Here's my brute-force solution to the knapsack problem. I like it! The > running time I think is O(2**n) where n is the number of items, so if you > plan to stuff like 30 or more items in your knapsack then my algorithm may > not provide a very fast, efficient approach! But for smaller problems the > running time should not be that bad. > > I know somebody on the list wrote, "For the love of other developers, > please use 4 spaces!" Well, I wish I could be accommodating, but.... I'm > not a big fan of just 4 spaces!!! I gotta have 6 spaces at least. Don't > know why! Maybe there's something wrong with my eyes, right? > > This was actually a problem on my Algorithms final at Northeastern. (But > we had to write our code in Java, and we couldn't test it on a computer. > Just our best handwritten approximation of the correct code.) > > Just sharing this with everyone on the list. I hope the feedback is > good! If not, well.... you can't complain about the price cause it's > FREE!!! LOL!!! > > By the way, on a totally different subject here, have you noticed that a > lot of CS professors think that all their students are plagiarists, > downloading all their program files from Github and StackOverflow? I gotta > say that this attitude is really offensive to me because I don't steal > other people's programs. I write my own! I've got a couple friends in > other states with PhD's (both in mathematics) and I have heard plenty of > stories about professors guilty of plagiarism, stealing work from graduate > students and research assistants and then taking all the credit for it. I > heard a similar story from a guy who was a graduate history major at DePaul > a long time ago. He told me that some academics that he worked with at > DePaul were absolutely ruthless, and thought it was perfectly okay to take > credit for the work of graduate students and research assistants! I just > get tired of professors who imply that their students are all a big bunch > of thieves and plagiarists. I'm sure it happens, but I doubt if it happens > with any great regularity. What do you think? > > By the way, I'm pretty sure that the famous KNAPSACK PROBLEM is really a > special type of linear programming problem that has integer constraints. > Linear programming is definitely pretty interesting, but some of the > algorithms can get kind of rough and intimidating. But I have heard that > the algorithms of linear programming and operations research in general are > extremely important in business and economics. > > Have a fun and fabulous weekend! > > Kind regards, > > Douglas Lewit > > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Sat Aug 8 12:42:40 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Sat, 8 Aug 2015 05:42:40 -0500 Subject: [Chicago] The KnapSack problem. In-Reply-To: References: Message-ID: All, The n is supposed to be an exponential apparently the cut and paste didn't preserve its formatting. so it is O(1.32113)^n On Sat, Aug 8, 2015 at 5:28 AM, Joshua Herman wrote: > Dear Lewellit, > The KNAPSACK problem is NP-complete as a decision problem and NP-hard as a > optimization problem. > Linear programming is NP-hard and I believe from the complexity zoo that > it also is a member of the complexity class FP. > > I believe if you take your KNAPSCAK problem and you reduce it to a SAT > solve the runtime would be much better. It would be > O(1.32113n) > with a sat solver that you can use below > http://cstheory.stackexchange.com/a/1070/5385 > > Sincerely, > Joshua Herman > > On Sat, Aug 8, 2015 at 1:35 AM, Lewit, Douglas wrote: > >> Hi guys, >> >> Here's my brute-force solution to the knapsack problem. I like it! The >> running time I think is O(2**n) where n is the number of items, so if you >> plan to stuff like 30 or more items in your knapsack then my algorithm may >> not provide a very fast, efficient approach! But for smaller problems the >> running time should not be that bad. >> >> I know somebody on the list wrote, "For the love of other developers, >> please use 4 spaces!" Well, I wish I could be accommodating, but.... I'm >> not a big fan of just 4 spaces!!! I gotta have 6 spaces at least. Don't >> know why! Maybe there's something wrong with my eyes, right? >> >> This was actually a problem on my Algorithms final at Northeastern. (But >> we had to write our code in Java, and we couldn't test it on a computer. >> Just our best handwritten approximation of the correct code.) >> >> Just sharing this with everyone on the list. I hope the feedback is >> good! If not, well.... you can't complain about the price cause it's >> FREE!!! LOL!!! >> >> By the way, on a totally different subject here, have you noticed that a >> lot of CS professors think that all their students are plagiarists, >> downloading all their program files from Github and StackOverflow? I gotta >> say that this attitude is really offensive to me because I don't steal >> other people's programs. I write my own! I've got a couple friends in >> other states with PhD's (both in mathematics) and I have heard plenty of >> stories about professors guilty of plagiarism, stealing work from graduate >> students and research assistants and then taking all the credit for it. I >> heard a similar story from a guy who was a graduate history major at DePaul >> a long time ago. He told me that some academics that he worked with at >> DePaul were absolutely ruthless, and thought it was perfectly okay to take >> credit for the work of graduate students and research assistants! I just >> get tired of professors who imply that their students are all a big bunch >> of thieves and plagiarists. I'm sure it happens, but I doubt if it happens >> with any great regularity. What do you think? >> >> By the way, I'm pretty sure that the famous KNAPSACK PROBLEM is really a >> special type of linear programming problem that has integer constraints. >> Linear programming is definitely pretty interesting, but some of the >> algorithms can get kind of rough and intimidating. But I have heard that >> the algorithms of linear programming and operations research in general are >> extremely important in business and economics. >> >> Have a fun and fabulous weekend! >> >> Kind regards, >> >> Douglas Lewit >> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From d-lewit at neiu.edu Mon Aug 10 07:42:56 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Mon, 10 Aug 2015 00:42:56 -0500 Subject: [Chicago] Differences between Interpreted and Compiled Languages. Message-ID: Hey guys, I've been playing around with Ocaml lately. Definitely an interesting language. Very different from Python, although like Python's IDLE and Anaconda implementations, Ocaml has an interactive "top level" that makes it easy to try out the effects of various one-liners, etc. When you compile an Ocaml file you end up with a bunch of other files. So if my source code is FindPrimes.ml, after compilation I can see files like FindPrimes.cmi and FindPrimes.cmx in my directory. There's also a FindPrimes executable in my directory. (I could have called it something else, but I think it's more logical and easier to remember if you name your executables so that they have the same name as your source code.) Python is radically different. There's the source file and that's it! No linked files or executables or anything like that. Okay, so here's my question. I ***THINK*** (and I'm really guessing here) that interpreted languages interact with the operating system and that's the end of it. However, compiled languages go one step farther. Because the source file is compiled to native code, I think that a compiled language interacts with the operating system as well, but also has the capacity to interact directly with the computer's underlying architecture, which would explain why compiled languages tend to run faster than interpreted languages. Interestingly enough, isn't Java sort of in between? It is technically a compiled language, but the JVM (the Java interpreter) reads the bytecode file line by line just like Python's interpreter reads the .py file line by line. So then Java is not strictly compiled or strictly interpreted; actually I think Java is both! Ocaml is definitely kind of cool, but can be challenging. Ints and floats cannot be mixed together in the same calculation. But I think Ocaml has one huge advantage. I believe that the language is considered to be very "safe", meaning that if your Ocaml file compiles then for sure it's going to run. So there are no runtime errors in Ocaml, just compile-time errors. (Unless at runtime the user inputs a value that is an invalid argument to some function in the program, etc.) Best, Douglas Lewit -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Mon Aug 10 08:42:00 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Mon, 10 Aug 2015 01:42:00 -0500 Subject: [Chicago] Differences between Interpreted and Compiled Languages. In-Reply-To: References: Message-ID: Dear Lewit, This is a very confusing question. This also starts a bunch of flame wars. Let us take an example of Python. You have a python interpreter correct? The .pyc files are byte code interpretations of python. This is not machine code but interpreted by the python runtime. Hypothetically could I compile python to another language? There is a project called PyPy. The purpose of this is to translate python into a restricted subset of python. Why would we want to do this? Then we can do cool things like specify other languages in python. This may come in use somehow but it is cool that we have the ability to do so. There are implementations of Scheme (I like this language) in Rpython. So the better question is "is my thing that I use to make my program work a python interpreter and what does it eventually do. Also your second question on ocaml is where the fashionalbe thing now is to add "optional types" to a dynamic languages so that people don't violate the rules of putting a string where an int should be etc. I believe this is a PEP that will go into python 3. Sincerely, Joshua Herman On Mon, Aug 10, 2015 at 12:42 AM, Lewit, Douglas wrote: > Hey guys, > > I've been playing around with Ocaml lately. Definitely an interesting > language. Very different from Python, although like Python's IDLE and > Anaconda implementations, Ocaml has an interactive "top level" that makes > it easy to try out the effects of various one-liners, etc. When you > compile an Ocaml file you end up with a bunch of other files. So if my > source code is FindPrimes.ml, after compilation I can see files like > FindPrimes.cmi and FindPrimes.cmx in my directory. There's also a > FindPrimes executable in my directory. (I could have called it something > else, but I think it's more logical and easier to remember if you name your > executables so that they have the same name as your source code.) > > Python is radically different. There's the source file and that's it! No > linked files or executables or anything like that. > > Okay, so here's my question. I ***THINK*** (and I'm really guessing here) > that interpreted languages interact with the operating system and that's > the end of it. However, compiled languages go one step farther. Because > the source file is compiled to native code, I think that a compiled > language interacts with the operating system as well, but also has the > capacity to interact directly with the computer's underlying architecture, > which would explain why compiled languages tend to run faster than > interpreted languages. > > Interestingly enough, isn't Java sort of in between? It is technically a > compiled language, but the JVM (the Java interpreter) reads the bytecode > file line by line just like Python's interpreter reads the .py file line by > line. So then Java is not strictly compiled or strictly interpreted; > actually I think Java is both! > > Ocaml is definitely kind of cool, but can be challenging. Ints and floats > cannot be mixed together in the same calculation. But I think Ocaml has > one huge advantage. I believe that the language is considered to be very > "safe", meaning that if your Ocaml file compiles then for sure it's going > to run. So there are no runtime errors in Ocaml, just compile-time errors. > (Unless at runtime the user inputs a value that is an invalid argument to > some function in the program, etc.) > > Best, > > Douglas Lewit > > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Mon Aug 10 09:47:36 2015 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 10 Aug 2015 00:47:36 -0700 Subject: [Chicago] Differences between Interpreted and Compiled Languages. In-Reply-To: References: Message-ID: On Sun, Aug 9, 2015 at 10:42 PM, Lewit, Douglas wrote: > > Python is radically different. There's the source file and that's it! No > linked files or executables or anything like that. > > You might be forgetting about the .pyc file that is compiled from .py source, down to bytecodes. Python is similar to Java therefore, in targeting a virtual machine. Nor is Python the only language to target said VM, if you count Hy. https://hy.readthedocs.org/en/latest/tutorial.html#hy-python-interop Here's a blog post I wrote recently that might help clear things up a bit: http://mybizmo.blogspot.com/2015/08/eclipse-for-python-java-clojure.html Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From shekay at pobox.com Mon Aug 10 16:54:35 2015 From: shekay at pobox.com (sheila miguez) Date: Mon, 10 Aug 2015 09:54:35 -0500 Subject: [Chicago] EuroPython 2015 talks Message-ID: Hi all, Individual talks are getting posted to the EuroPython youtube channel. They're not done yet, but getting there. https://www.youtube.com/playlist?list=PL8uoeex94UhGGUH0mFb-StlZ1WYGWiJfP The organizer who is uploading everything is also going to be archiving them on archive.org and giving me all the metadata so I can post to pyvideo.org, but I thought everyone might like to see progress. -- shekay at pobox.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From d-lewit at neiu.edu Mon Aug 10 20:03:57 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Mon, 10 Aug 2015 13:03:57 -0500 Subject: [Chicago] Differences between Interpreted and Compiled Languages. In-Reply-To: References: Message-ID: Hi Joshua, I never meant to start a "flame war"! What is a PEP? What is RPython? Thanks! Douglas. On Mon, Aug 10, 2015 at 1:42 AM, Joshua Herman wrote: > Dear Lewit, > This is a very confusing question. This also starts a bunch of flame wars. > > Let us take an example of Python. You have a python interpreter correct? > The .pyc files are byte code interpretations of python. This is not > machine code but interpreted by the python runtime. > > Hypothetically could I compile python to another language? > > There is a project called PyPy. The purpose of this is to translate python > into a restricted subset of python. Why would we want to do this? > > Then we can do cool things like specify other languages in python. This > may come in use somehow but it is cool that we have the ability to do so. > There are implementations of Scheme (I like this language) in Rpython. > > So the better question is "is my thing that I use to make my program work > a python interpreter and what does it eventually do. > > Also your second question on ocaml is where the fashionalbe thing now is > to add "optional types" to a dynamic languages so that people don't violate > the rules of putting a string where an int should be etc. I believe this is > a PEP that will go into python 3. > Sincerely, > Joshua Herman > > > > > On Mon, Aug 10, 2015 at 12:42 AM, Lewit, Douglas wrote: > >> Hey guys, >> >> I've been playing around with Ocaml lately. Definitely an interesting >> language. Very different from Python, although like Python's IDLE and >> Anaconda implementations, Ocaml has an interactive "top level" that makes >> it easy to try out the effects of various one-liners, etc. When you >> compile an Ocaml file you end up with a bunch of other files. So if my >> source code is FindPrimes.ml, after compilation I can see files like >> FindPrimes.cmi and FindPrimes.cmx in my directory. There's also a >> FindPrimes executable in my directory. (I could have called it something >> else, but I think it's more logical and easier to remember if you name your >> executables so that they have the same name as your source code.) >> >> Python is radically different. There's the source file and that's it! >> No linked files or executables or anything like that. >> >> Okay, so here's my question. I ***THINK*** (and I'm really guessing >> here) that interpreted languages interact with the operating system and >> that's the end of it. However, compiled languages go one step farther. >> Because the source file is compiled to native code, I think that a compiled >> language interacts with the operating system as well, but also has the >> capacity to interact directly with the computer's underlying architecture, >> which would explain why compiled languages tend to run faster than >> interpreted languages. >> >> Interestingly enough, isn't Java sort of in between? It is technically a >> compiled language, but the JVM (the Java interpreter) reads the bytecode >> file line by line just like Python's interpreter reads the .py file line by >> line. So then Java is not strictly compiled or strictly interpreted; >> actually I think Java is both! >> >> Ocaml is definitely kind of cool, but can be challenging. Ints and >> floats cannot be mixed together in the same calculation. But I think Ocaml >> has one huge advantage. I believe that the language is considered to be >> very "safe", meaning that if your Ocaml file compiles then for sure it's >> going to run. So there are no runtime errors in Ocaml, just compile-time >> errors. (Unless at runtime the user inputs a value that is an invalid >> argument to some function in the program, etc.) >> >> Best, >> >> Douglas Lewit >> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From d-lewit at neiu.edu Mon Aug 10 20:06:30 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Mon, 10 Aug 2015 13:06:30 -0500 Subject: [Chicago] Differences between Interpreted and Compiled Languages. In-Reply-To: References: Message-ID: Hi there Kirby, You're right. I almost forgot about the .pyc files! But sometimes Python creates them and at other times Python does not. I've noticed that those .pyc files show up when I write some code and then treat the file as a module rather than run the file as an independent program. What is Hy? I never heard of that before. Thanks! Best, Douglas. On Mon, Aug 10, 2015 at 2:47 AM, kirby urner wrote: > > > On Sun, Aug 9, 2015 at 10:42 PM, Lewit, Douglas wrote: > >> >> Python is radically different. There's the source file and that's it! >> No linked files or executables or anything like that. >> >> > You might be forgetting about the .pyc file that is compiled from .py > source, down to bytecodes. > > Python is similar to Java therefore, in targeting a virtual machine. Nor > is Python the only language to target said VM, if you count Hy. > > https://hy.readthedocs.org/en/latest/tutorial.html#hy-python-interop > > Here's a blog post I wrote recently that might help clear things up a bit: > > http://mybizmo.blogspot.com/2015/08/eclipse-for-python-java-clojure.html > > Kirby > > > > > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Mon Aug 10 20:27:16 2015 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 10 Aug 2015 11:27:16 -0700 Subject: [Chicago] Differences between Interpreted and Compiled Languages. In-Reply-To: References: Message-ID: On Mon, Aug 10, 2015 at 11:06 AM, Lewit, Douglas wrote: > Hi there Kirby, > > You're right. I almost forgot about the .pyc files! But sometimes Python > creates them and at other times Python does not. I've noticed that those > .pyc files show up when I write some code and then treat the file as a > module rather than run the file as an independent program. > > What is Hy? I never heard of that before. > > Thanks! > > Best, > > Douglas. > > The bytecode files are essential. 3.4 puts them in a subfolder by default. There's no running Python source code directly, it always compiles to bytecodes first. We say Python is "interpreted" but that's more to say the bytecodes are not the chip's native assembly language, whereas C compiles because that's what it puts out: machine code native to the chip. With Python, the VM is between the source code and the chip. Even when you just use the REPL (interactive console) the expressions compile to bytecodes first. The dis module for disassembly lets you view those bytecodes if curious. Hy is a language that applies LISP syntax to Python while compiling to the same VM. Python does not have to compile to the C language VM. Jython compiles to JVM bytecodes while IronPython compiles to the bytecodes used by the .NET Common Language Runtime (CLR). I'm somewhat interested in the Python -> Java -> Clojure spiral (one keeps going through all three, but with different topics) as all share the same VM. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From randy7771026 at gmail.com Mon Aug 10 20:42:48 2015 From: randy7771026 at gmail.com (Randy Baxley) Date: Mon, 10 Aug 2015 13:42:48 -0500 Subject: [Chicago] Differences between Interpreted and Compiled Languages. In-Reply-To: References: Message-ID: 20 is a fav https://www.python.org/dev/peps/ On Mon, Aug 10, 2015 at 1:27 PM, kirby urner wrote: > > > On Mon, Aug 10, 2015 at 11:06 AM, Lewit, Douglas wrote: > >> Hi there Kirby, >> >> You're right. I almost forgot about the .pyc files! But sometimes >> Python creates them and at other times Python does not. I've noticed that >> those .pyc files show up when I write some code and then treat the file as >> a module rather than run the file as an independent program. >> >> What is Hy? I never heard of that before. >> >> Thanks! >> >> Best, >> >> Douglas. >> >> > The bytecode files are essential. 3.4 puts them in a subfolder by > default. There's no running Python source code directly, it always > compiles to bytecodes first. > > We say Python is "interpreted" but that's more to say the bytecodes are > not the chip's native assembly language, whereas C compiles because that's > what it puts out: machine code native to the chip. > > With Python, the VM is between the source code and the chip. Even when > you just use the REPL (interactive console) the expressions compile to > bytecodes first. The dis module for disassembly lets you view those > bytecodes if curious. > > Hy is a language that applies LISP syntax to Python while compiling to the > same VM. > > Python does not have to compile to the C language VM. Jython compiles to > JVM bytecodes while IronPython compiles to the bytecodes used by the .NET > Common Language Runtime (CLR). > > I'm somewhat interested in the Python -> Java -> Clojure spiral (one keeps > going through all three, but with different topics) as all share the same > VM. > > Kirby > > > > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From randy7771026 at gmail.com Mon Aug 10 20:52:40 2015 From: randy7771026 at gmail.com (Randy Baxley) Date: Mon, 10 Aug 2015 13:52:40 -0500 Subject: [Chicago] Differences between Interpreted and Compiled Languages. In-Reply-To: References: Message-ID: Some people can certainly burst into flames over a lot of things. Naming conventions, cameling, if speed of compiling or speed of processing is the higher goal, if machine language, assembler, or X language is the higher, lower or closer to the machine or most intuitive, I say Blue and Gold On Mon, Aug 10, 2015 at 1:03 PM, Lewit, Douglas wrote: > Hi Joshua, > > I never meant to start a "flame war"! > > What is a PEP? > > What is RPython? > > Thanks! > > Douglas. > > > On Mon, Aug 10, 2015 at 1:42 AM, Joshua Herman > wrote: > >> Dear Lewit, >> This is a very confusing question. This also starts a bunch of flame wars. >> >> Let us take an example of Python. You have a python interpreter correct? >> The .pyc files are byte code interpretations of python. This is not >> machine code but interpreted by the python runtime. >> >> Hypothetically could I compile python to another language? >> >> There is a project called PyPy. The purpose of this is to translate >> python into a restricted subset of python. Why would we want to do this? >> >> Then we can do cool things like specify other languages in python. This >> may come in use somehow but it is cool that we have the ability to do so. >> There are implementations of Scheme (I like this language) in Rpython. >> >> So the better question is "is my thing that I use to make my program work >> a python interpreter and what does it eventually do. >> >> Also your second question on ocaml is where the fashionalbe thing now is >> to add "optional types" to a dynamic languages so that people don't violate >> the rules of putting a string where an int should be etc. I believe this is >> a PEP that will go into python 3. >> Sincerely, >> Joshua Herman >> >> >> >> >> On Mon, Aug 10, 2015 at 12:42 AM, Lewit, Douglas >> wrote: >> >>> Hey guys, >>> >>> I've been playing around with Ocaml lately. Definitely an interesting >>> language. Very different from Python, although like Python's IDLE and >>> Anaconda implementations, Ocaml has an interactive "top level" that makes >>> it easy to try out the effects of various one-liners, etc. When you >>> compile an Ocaml file you end up with a bunch of other files. So if my >>> source code is FindPrimes.ml, after compilation I can see files like >>> FindPrimes.cmi and FindPrimes.cmx in my directory. There's also a >>> FindPrimes executable in my directory. (I could have called it something >>> else, but I think it's more logical and easier to remember if you name your >>> executables so that they have the same name as your source code.) >>> >>> Python is radically different. There's the source file and that's it! >>> No linked files or executables or anything like that. >>> >>> Okay, so here's my question. I ***THINK*** (and I'm really guessing >>> here) that interpreted languages interact with the operating system and >>> that's the end of it. However, compiled languages go one step farther. >>> Because the source file is compiled to native code, I think that a compiled >>> language interacts with the operating system as well, but also has the >>> capacity to interact directly with the computer's underlying architecture, >>> which would explain why compiled languages tend to run faster than >>> interpreted languages. >>> >>> Interestingly enough, isn't Java sort of in between? It is technically >>> a compiled language, but the JVM (the Java interpreter) reads the bytecode >>> file line by line just like Python's interpreter reads the .py file line by >>> line. So then Java is not strictly compiled or strictly interpreted; >>> actually I think Java is both! >>> >>> Ocaml is definitely kind of cool, but can be challenging. Ints and >>> floats cannot be mixed together in the same calculation. But I think Ocaml >>> has one huge advantage. I believe that the language is considered to be >>> very "safe", meaning that if your Ocaml file compiles then for sure it's >>> going to run. So there are no runtime errors in Ocaml, just compile-time >>> errors. (Unless at runtime the user inputs a value that is an invalid >>> argument to some function in the program, etc.) >>> >>> Best, >>> >>> Douglas Lewit >>> >>> >>> _______________________________________________ >>> Chicago mailing list >>> Chicago at python.org >>> https://mail.python.org/mailman/listinfo/chicago >>> >>> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brianhray at gmail.com Thu Aug 13 15:41:45 2015 From: brianhray at gmail.com (Brian Ray) Date: Thu, 13 Aug 2015 09:41:45 -0400 Subject: [Chicago] [ANN] August ChiPy Tonight Message-ID: *When:* Aug. 13, 2015, 7 p.m. *Where:* Braintree *new* HQ Merchandise Mart 222 W Merchandise Mart Plaza 8th Floor Chicago, IL 60654 - *Data Games in Python* (0:20:00 Minutes) By: C. S. Schroeder There has been recent work on the taxonomy of games which are based, one way or another, on real world data. Typically these games help people learn that data or how to cope with it. The traditional examples are simulation games (flight, driving, etc.), while other games incorporate data in such a way that it is beneficial to learn the real world data in the game play (trivia). These types of data-games commonly have a domain specific focus. We intend to explore the possibility of interactive games which help people to learn data analysis, in general, implementing some such games in python using web2py and Scipy. - *Automating a fishtank with python and IoT sensors* (1:00:00 Minutes) By: Benjamin Chodroff Fish tanks are simple enough that even a child can maintain them. I don't have children yet to maintain my tank, but luckily my very patient wife has allowed me to explore over engineering a solution. In this talk we'll explore how python scripts running on a Raspberry Pi can be used to measure and control many aspects of maintaining a fish tank or any number of IOT applications. A demo of the hardware connectivity will be shown which includes an Atlas Scientific pH meter, digital submerged temperature probe, liquid flow meter, liquid level sensor, video camera, and an eight channel relay controlling 12V DC water and 120V AC CO2 gas solenoids, peristaltic dosing pumps, and lighting. A live python coding demo with sample scripts will show how to connect to the serial devices and control the analog and digital hardware. We will broadcast the measured data and hardware states using the Eclipse Paho MQTT python client with the IBM IoT Foundation on BlueMix or IBM MessageSight to create a dashboard using a Javascript MQTT client and Freeboard.io. Finally, we'll create a linux script which allows the attached RaspiCam to live stream a HD video to Google's Youtube Live so the whole world can see. - *Keep calm and conda install* (0:20:00 Minutes) By: Jonathan J. Helmus Conda is a cross platform, package management system widely used in the scientific and data science Python communities. Although designed for Python packages, conda can be used to package and distribute software written in any language. This talk will cover how to use conda to install and manage scientific packages as well as how conda can be used to create isolated Python environment similar to virtualenv. Conda?s use within the Anaconda and Miniconda Python distributions will be discussed as an easy method for obtaining a full featured SciPy stack. Instructions on building packages with conda and hosting them on Anaconda.org will be covered briefly. RSVP Http://chipy.org -- Brian Ray @brianray (773) 669-7717 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tathagatadg at gmail.com Thu Aug 13 18:13:51 2015 From: tathagatadg at gmail.com (Tathagata Dasgupta) Date: Thu, 13 Aug 2015 16:13:51 +0000 Subject: [Chicago] Has your RSVP status for tonight changed? Message-ID: Hello all, We are expecting a big turnout tonight - because it's going to be the best meeting ever! In case your RSVP status has changed, could you please update it on meetup.com (or chipy.org if you like the old world charm)? That'll help us get a better estimate for ordering pizza. See you at the best meeting ever tonight ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From benjamin.chodroff at gmail.com Fri Aug 14 21:58:14 2015 From: benjamin.chodroff at gmail.com (Benjamin Chodroff) Date: Fri, 14 Aug 2015 14:58:14 -0500 Subject: [Chicago] IoT Aquarium Message-ID: Hi Chipy! I had a great time yesterday at my first Chipy meetup. I'm looking forward to the next! As promised, here is a link to my IoT Aquarium with a Raspberry Pi. They have sample code and a few links to some helpful guides (including how to stream video to youtube live ). If you have any questions, don't hesitate to email me. http://www.slideshare.net/benjaminchodroff/iot-aquarium Myself and a few others from CloudOne just started working at 1871 in the Merchandise Mart. I would much rather be playing with python and Raspberry Pi's, so please drop a line (benjamin.chodroff at oncloudone.com) and come visit us! Ben Chodroff -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe.jasinski at gmail.com Sat Aug 15 06:08:24 2015 From: joe.jasinski at gmail.com (Joe Jasinski) Date: Fri, 14 Aug 2015 23:08:24 -0500 Subject: [Chicago] Slides from "Data Games in Python" talk at Chipy Message-ID: Hi all, I'd like to forward along the slides from last night's ChiPy talk "Data Games in Python" by C. S. Schroeder. They can be found at the following url. http://www.atheoryof.net/init/static/DataGame.pdf -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Sat Aug 15 23:37:39 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Sat, 15 Aug 2015 16:37:39 -0500 Subject: [Chicago] Slides from "Data Games in Python" talk at Chipy In-Reply-To: References: Message-ID: Supposedly you can use visual long term memory for massive storage according to this paper by MIT http://cvcl.mit.edu/papers/BradyKonkleAlvarezOliva_PNAS2008.pdf On Fri, Aug 14, 2015 at 11:08 PM, Joe Jasinski wrote: > Hi all, > > I'd like to forward along the slides from last night's ChiPy talk "Data > Games in Python" by C. S. Schroeder. They can be found at the following > url. > > http://www.atheoryof.net/init/static/DataGame.pdf > > > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brianhray at gmail.com Mon Aug 17 08:25:55 2015 From: brianhray at gmail.com (Brian Ray) Date: Mon, 17 Aug 2015 02:25:55 -0400 Subject: [Chicago] PEP 0498 Message-ID: I kinda like this idea: >>> import datetime >>> name = 'Fred' >>> age = 50 >>> anniversary = datetime.date(1991, 10, 12) >>> f'My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.' 'My name is Fred, my age next year is 51, my anniversary is Saturday, October 12, 1991.' >>> f'He said his name is {name!r}.' "He said his name is 'Fred'." I am not so sure about putting python code inside the strings is a good idea; but, overall I like the concept, as I found myself type .format() an awful lot lately. ref: https://www.python.org/dev/peps/pep-0498/ -- Brian Ray @brianray (773) 669-7717 -------------- next part -------------- An HTML attachment was scrubbed... URL: From wirth.jason at gmail.com Mon Aug 17 12:55:35 2015 From: wirth.jason at gmail.com (Jason Wirth) Date: Mon, 17 Aug 2015 10:55:35 +0000 Subject: [Chicago] PEP 0498 In-Reply-To: References: Message-ID: This looks interesting. I love using named variables in .format() but I really hate all the boiler plate. .format(age=age, name=name) On Mon, Aug 17, 2015 at 1:26 AM Brian Ray wrote: > I kinda like this idea: > > >>> import datetime > >>> name = 'Fred' > >>> age = 50 > >>> anniversary = datetime.date(1991, 10, 12) > >>> f'My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.' > 'My name is Fred, my age next year is 51, my anniversary is Saturday, October 12, 1991.' > >>> f'He said his name is {name!r}.' > "He said his name is 'Fred'." > > I am not so sure about putting python code inside the strings is a good > idea; but, overall I like the concept, as I found myself type .format() an > awful lot lately. > > > ref: https://www.python.org/dev/peps/pep-0498/ > > > > -- > Brian Ray > @brianray > (773) 669-7717 > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jjhelmus at gmail.com Tue Aug 18 00:27:12 2015 From: jjhelmus at gmail.com (Jonathan Helmus) Date: Mon, 17 Aug 2015 17:27:12 -0500 Subject: [Chicago] Slides from "Keep calm and conda install" Message-ID: <55D25FC0.2060607@gmail.com> All, My slides from the past weeks ChiPy meeting talk, "Keep calm and conda install" can be found nicely rendered at: http://nbviewer.ipython.org/format/slides/github/jjhelmus/presentations/blob/master/2015_ChiPy_conda_talk/ChiPy_conda_talk.ipynb The IPython notebook of the talk with speaker notes, as well as links to other talks I've given can be found in my presentations GitHub repo, https://github.com/jjhelmus/presentations Hope everyone enjoyed last weeks meeting as much as I did. Cheers, - Jonathan Helmus From tathagatadg at gmail.com Thu Aug 20 05:49:50 2015 From: tathagatadg at gmail.com (Tathagata Dasgupta) Date: Wed, 19 Aug 2015 22:49:50 -0500 Subject: [Chicago] Fwd: O'Reilly Partners: Announcing Learning Paths In-Reply-To: References: Message-ID: Hello ChiPy, Please check the following from OReilly Media. Let the group know if you found any of the learning paths interesting and helpful ... ---------- Forwarded message --------- From: Jennie Kimmel Date: Wed, Aug 19, 2015 at 4:58 PM Subject: O'Reilly Partners: Announcing Learning Paths To: tathagatadg+foss at gmail.com Dear Tathagata, We?ve launched a new set of products from O?Reilly and we wanted to share the news. They?re called Learning Paths . Each Learning Path is a logical progression of video training to take a customer from step one to proficiency. The steps in each Learning Path were carefully selected by our editors and provide a clear-cut path to expertise in a wide range of topics. We?d love to have you partner with us in launching and promoting these exciting, new Learning Paths. We?ve just added the first 10 to the Partner Center , and we?re planning to release a new Learning Path daily over the next 2 weeks. Below you will find a list of our first Learning Paths, available for a limited-time, introductory price of $99. It?s an incredible value. Purchased alone, you?d pay more for just one video in the Learning Path than you?d pay for this new product. - Git - Beginning UX Design - Design for Mobile - Beginning Javascript - Hadoop for Data Scientist - Data Visualization - Data Science with R - Beginning Java - Python for Data - Networking for Sysadmins Please share this news with your communities. P.S. Don?t forget?we?re adding new Learning Paths daily?one a day for the next two weeks. Thank you, The Partners Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From tanya at tickel.net Thu Aug 20 12:24:31 2015 From: tanya at tickel.net (Tanya Schlusser) Date: Thu, 20 Aug 2015 05:24:31 -0500 Subject: [Chicago] for those interested in environment management uing visual c++ Message-ID: Hi guys, sorry to bug the group about this but another meetup group I'm in (C++ users) has a light turnout now for our upcoming session on Visual C++ next Tuesday August 25. Visual C++ is the compiler for CPython on windows, so if anyone develops Python extensions using C and windows, the talk should be useful. It's about a tool called NuGet that helps with environment / build management. Please share: http://www.meetup.com/Chicago-C-CPP-Users-Group/events/223160712/ thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From programo.sapien at gmail.com Fri Aug 21 20:04:56 2015 From: programo.sapien at gmail.com (Aswin kumar) Date: Fri, 21 Aug 2015 13:04:56 -0500 Subject: [Chicago] New to python : Suggestions Message-ID: Hi Folks, I am new to python programming language and I would like to learn web programming in python.I have an idea(borrowing some ideas from Reddit) and I want to implement the idea in Python.I have started with the online edition of "Learn Python the hard way". Could anybody suggest me good resources for web programming in python? Also May I know when and where could be the next possible meet? Regards, Aswin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rahul013k at gmail.com Fri Aug 21 20:46:57 2015 From: rahul013k at gmail.com (rahul krish) Date: Fri, 21 Aug 2015 13:46:57 -0500 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: Message-ID: Codeacademy.com python course is a good start. Best, Rahul Krishnamurthy On Aug 21, 2015 1:45 PM, "Aswin kumar" wrote: > Hi Folks, > > I am new to python programming language and I would like to learn web > programming in python.I have an idea(borrowing some ideas from Reddit) and > I want to implement the idea in Python.I have started with the online > edition of "Learn Python the hard way". Could anybody suggest me good > resources for web programming in python? > > > Also May I know when and where could be the next possible meet? > > Regards, > Aswin. > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at adamforsyth.net Fri Aug 21 20:59:45 2015 From: adam at adamforsyth.net (Adam Forsyth) Date: Fri, 21 Aug 2015 13:59:45 -0500 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: Message-ID: ChiPy meets on the second Thursday of every month, in or around the Loop. The best way to keep track is by signing up on Meetup or our website . On Fri, Aug 21, 2015 at 1:04 PM, Aswin kumar wrote: > Hi Folks, > > I am new to python programming language and I would like to learn web > programming in python.I have an idea(borrowing some ideas from Reddit) and > I want to implement the idea in Python.I have started with the online > edition of "Learn Python the hard way". Could anybody suggest me good > resources for web programming in python? > > > Also May I know when and where could be the next possible meet? > > Regards, > Aswin. > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From qholness at gmail.com Fri Aug 21 22:18:10 2015 From: qholness at gmail.com (Quentin Holness) Date: Fri, 21 Aug 2015 15:18:10 -0500 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: Message-ID: Brute force. Long nights. Coffee. Lots of coffee (vacuum brewed preferably) And practice making projects. Pull a not super complex git repo, figure out what the app/repo is/does and try replicating it to the best of your abilities. Also, I also recommend CodeAcademy. Quentin Holness M.S. Economics and Policy Analysis DePaul University Gmail |LinkedIn | Hit Points On Fri, Aug 21, 2015 at 1:59 PM, Adam Forsyth wrote: > ChiPy meets on the second Thursday of every month, in or around the Loop. > The best way to keep track is by signing up on Meetup > or our website . > > On Fri, Aug 21, 2015 at 1:04 PM, Aswin kumar > wrote: > >> Hi Folks, >> >> I am new to python programming language and I would like to learn web >> programming in python.I have an idea(borrowing some ideas from Reddit) and >> I want to implement the idea in Python.I have started with the online >> edition of "Learn Python the hard way". Could anybody suggest me good >> resources for web programming in python? >> >> >> Also May I know when and where could be the next possible meet? >> >> Regards, >> Aswin. >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From proba at allstate.com Fri Aug 21 23:38:21 2015 From: proba at allstate.com (Robare, Phillip (TEKSystems)) Date: Fri, 21 Aug 2015 21:38:21 +0000 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: Message-ID: <50869A74BA4F07468AD797C9BFF1FE3E0D96A3C6@A0185-XPO1026-C.ad.allstate.com> I guess the question is what exactly are you trying to learn? Learning Python is not that hard if you already know how to program. Learning to program (well) takes study, practice and time. Learning web programming in python is not too hard if already know web programming. Based upon your requirements you will need to pick your web framework ? Web2Py, Pyramid, Flask and Django are all alternatives. If you don?t already do web programming you will also have to learn HTML, CSS, and basic javascript programming. If you want to do anything modern looking you will also have to master one or more javascript libraries like jQuery. Be prepared, I think this journey will take you at least a year of hard work before you have learned enough to code your idea to a level where you will be ready to show it off. A good resource for HTML, CSS and javascript is the W3Schools (http://www.w3schools.com/) that have both tutorial and reference material available for free. Finally, if what you want to do is not really learn web programming, but instead you want to start a business based on your idea, there is a whole other set of skills you will need dealing with business and entrepreneurship. If you want to go that route the first test of your skills is extracting enough investment money from friends and family to pay a programmer who has already gone through the learning programming path and is willing to partner with you to create your initial demo. Phil Robare From: Chicago [mailto:chicago-bounces+proba=allstate.com at python.org] On Behalf Of Aswin kumar Sent: Friday, August 21, 2015 1:05 PM To: chicago at python.org Subject: [Chicago] New to python : Suggestions Hi Folks, I am new to python programming language and I would like to learn web programming in python.I have an idea(borrowing some ideas from Reddit) and I want to implement the idea in Python.I have started with the online edition of "Learn Python the hard way". Could anybody suggest me good resources for web programming in python? Also May I know when and where could be the next possible meet? Regards, Aswin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tanya at tickel.net Sat Aug 22 14:30:10 2015 From: tanya at tickel.net (Tanya Schlusser) Date: Sat, 22 Aug 2015 07:30:10 -0500 Subject: [Chicago] New to python : Suggestions Message-ID: Welcome to Python Aswin -- here's to many years of fun and productivity! I should plug the Django special interest group -- Django is like Python's version of Ruby on Rails -- it's a web framework. The next meeting is tomorrow (Sunday): http://www.meetup.com/_ChiPy_/events/224681564/ Also, you may be looking for a platform to host your creation for free. The two I know of are Heroku, which has great tutorials and free Postgres database (up to 10,000 rows of data), and PythonAnywhere which allows MySQL for free. - Heroku: https://www.pythonanywhere.com/ - PythonAnywhere: https://www.pythonanywhere.com/ Happy coding! -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Sat Aug 22 15:09:09 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Sat, 22 Aug 2015 08:09:09 -0500 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: Message-ID: Dear Ashwin, It sounds like to your original email your trying to copy reddit? There is a reason for reddit failure and it happens nearly to any social news site. Eventually it becomes so big that the users hate it. Multiple boards etc... at first you have to have nearly no rules and once you get big you will have many rules. I suggest you implement some way to reward two groups of people. Content creators (people who create posts on social news) Moderators (people who manage the boards) Those groups of people basically use reddit for either promotion of their product or to have a sense of power over the content creators. Reddits biggest success was the IAMA board. It allowed celebrities to have conversations with others. The big problem is that reddit may or may not make money at this point. They are shuffling upper management a bunch of times. This makes me believe that even the best people can't manage reddit anymore and it is ripe for disruption. You don't even have to follow the rules in this email. Possibly even making something different will make you successful. Regardless it is a good learning experience to try to make something you actually care about. That is the most important part about programming. Sincerely, Joshua Herman On Sat, Aug 22, 2015 at 7:30 AM, Tanya Schlusser wrote: > > Welcome to Python Aswin -- here's to many years of fun and productivity! > > > I should plug the Django special interest group -- Django is like Python's > version of Ruby on Rails -- it's a web framework. The next meeting is > tomorrow (Sunday): > > http://www.meetup.com/_ChiPy_/events/224681564/ > > Also, you may be looking for a platform to host your creation for free. > The two I know of are Heroku, which has great tutorials and free Postgres > database (up to 10,000 rows of data), and PythonAnywhere which allows MySQL > for free. > > > - Heroku: https://www.pythonanywhere.com/ > - PythonAnywhere: https://www.pythonanywhere.com/ > > > Happy coding! > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sat Aug 22 18:22:19 2015 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 22 Aug 2015 09:22:19 -0700 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: Message-ID: On Fri, Aug 21, 2015 at 11:04 AM, Aswin kumar wrote: > Hi Folks, > > I am new to python programming language and I would like to learn web > programming in python.I have an idea(borrowing some ideas from Reddit) and > I want to implement the idea in Python.I have started with the online > edition of "Learn Python the hard way". Could anybody suggest me good > resources for web programming in python? > > > Also May I know when and where could be the next possible meet? > > Regards, > Aswin. > An important consideration is *how* you want to implement your project, as a solo coder, or in collaboration with others, the recommended way for anything really big. I never knock the skill set of the solo coder, my habitual / career mode through many chapters. In going from self-employed coder / developer with many clients, mostly not using Python (I was groomed to work with proprietary software at first), into a collaborative corporate environment at O'Reilly Media, I've had to alter my notions of what coding is all about as an activity, taking in such workflows as SCRUM and Github. You may well be familiar with such lingo, but as someone who lived through the first "PC revolution" as an adult, this was all new to me. The project I'm looking at these days is an Open Source core for what I call an Asynchronous Learning Engine (ALE, pun on free beer). Say you want to teach Python to 30 people without anyone needing to fly anywhere. The important thing is getting student work to your inbox where you, their mentor, evaluate it and send it back. That's what we already have in-house and use daily (my day job is teaching Python using a not open source version of ALE). But could we transition to EC2 instances on AWS running Ubuntu and make this all something on Github? The prototype curriculum I'm working on is a separate project i.e. is "content" for said ALE: a spiral through Python -> Java -> Clojure -> Python... anod so on, continuing to go deeper in all three, starting in high school for math credit.[1] Great combo to later branch from if you need to wrap your head around something new as this spiral covers a lotta bases. Kirby More about ALE: http://worldgame.blogspot.com/2015/07/pws-personal-workspace.html (a month ago I was looking at Atom from Github as the default IDE for my curriculum however my need for embedded REPL has brought me back to Eclipse, what we're using now, with PyDev for Python and Counterclockwise for Clojure -- IntelliJ and Emacs would be additional candidates). [1] in some school systems with mandatory 3-years math for certificate (diploma) it's now possible to take math courses with a lot of computer science in them than in decades past, a reform occasioned by the surge in STEM and feedback from the high tech sector (I'm actually Silicon Forest based, only get to visit Chicago when I'm lucky -- was born there too). -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.galtieri at gmail.com Sat Aug 22 15:51:01 2015 From: daniel.galtieri at gmail.com (Daniel Galtieri) Date: Sat, 22 Aug 2015 08:51:01 -0500 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: Message-ID: This list is mostly geared towards the scientific python community, but there are a couple sections with links for general introduction to Python: https://github.com/ipython/ipython/wiki/A-gallery-of-interesting-IPython-Notebooks On Sat, Aug 22, 2015 at 8:09 AM, Joshua Herman wrote: > Dear Ashwin, > It sounds like to your original email your trying to copy reddit? > There is a reason for reddit failure and it happens nearly to any social > news site. Eventually it becomes so big that the users hate it. > > Multiple boards etc... at first you have to have nearly no rules and once > you get big you will have many rules. > > I suggest you implement some way to reward two groups of people. > Content creators (people who create posts on social news) > Moderators (people who manage the boards) > > Those groups of people basically use reddit for either promotion of their > product or to have a sense of power over the content creators. > > Reddits biggest success was the IAMA board. It allowed celebrities to have > conversations with others. > > The big problem is that reddit may or may not make money at this point. > They are shuffling upper management a bunch of times. This makes me believe > that even the best people can't manage reddit anymore and it is ripe for > disruption. > > You don't even have to follow the rules in this email. Possibly even > making something different will make you successful. > > Regardless it is a good learning experience to try to make something you > actually care about. That is the most important part about programming. > > Sincerely, > Joshua Herman > > > On Sat, Aug 22, 2015 at 7:30 AM, Tanya Schlusser wrote: > >> >> Welcome to Python Aswin -- here's to many years of fun and productivity! >> >> >> I should plug the Django special interest group -- Django is like >> Python's version of Ruby on Rails -- it's a web framework. The next meeting >> is tomorrow (Sunday): >> >> http://www.meetup.com/_ChiPy_/events/224681564/ >> >> Also, you may be looking for a platform to host your creation for free. >> The two I know of are Heroku, which has great tutorials and free Postgres >> database (up to 10,000 rows of data), and PythonAnywhere which allows MySQL >> for free. >> >> >> - Heroku: https://www.pythonanywhere.com/ >> - PythonAnywhere: https://www.pythonanywhere.com/ >> >> >> Happy coding! >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From namusoke at hotmail.com Mon Aug 24 13:35:01 2015 From: namusoke at hotmail.com (Valentina Kibuyaga) Date: Mon, 24 Aug 2015 06:35:01 -0500 Subject: [Chicago] New to python : Suggestions In-Reply-To: <50869A74BA4F07468AD797C9BFF1FE3E0D96A3C6@A0185-XPO1026-C.ad.allstate.com> References: , <50869A74BA4F07468AD797C9BFF1FE3E0D96A3C6@A0185-XPO1026-C.ad.allstate.com> Message-ID: Kudos Phil! Excellent advice and ABSOLUTELY correct! ABSOLUTE being the key word! Valentina Kibuyaga From: proba at allstate.com To: chicago at python.org Date: Fri, 21 Aug 2015 21:38:21 +0000 Subject: Re: [Chicago] New to python : Suggestions I guess the question is what exactly are you trying to learn? Learning Python is not that hard if you already know how to program. Learning to program (well) takes study, practice and time. Learning web programming in python is not too hard if already know web programming. Based upon your requirements you will need to pick your web framework ? Web2Py, Pyramid, Flask and Django are all alternatives. If you don?t already do web programming you will also have to learn HTML, CSS, and basic javascript programming. If you want to do anything modern looking you will also have to master one or more javascript libraries like jQuery. Be prepared, I think this journey will take you at least a year of hard work before you have learned enough to code your idea to a level where you will be ready to show it off. A good resource for HTML, CSS and javascript is the W3Schools (http://www.w3schools.com/) that have both tutorial and reference material available for free. Finally, if what you want to do is not really learn web programming, but instead you want to start a business based on your idea, there is a whole other set of skills you will need dealing with business and entrepreneurship. If you want to go that route the first test of your skills is extracting enough investment money from friends and family to pay a programmer who has already gone through the learning programming path and is willing to partner with you to create your initial demo. Phil Robare From: Chicago [mailto:chicago-bounces+proba=allstate.com at python.org] On Behalf Of Aswin kumar Sent: Friday, August 21, 2015 1:05 PM To: chicago at python.org Subject: [Chicago] New to python : Suggestions Hi Folks, I am new to python programming language and I would like to learn web programming in python.I have an idea(borrowing some ideas from Reddit) and I want to implement the idea in Python.I have started with the online edition of "Learn Python the hard way". Could anybody suggest me good resources for web programming in python? Also May I know when and where could be the next possible meet? Regards, Aswin. _______________________________________________ Chicago mailing list Chicago at python.org https://mail.python.org/mailman/listinfo/chicago -------------- next part -------------- An HTML attachment was scrubbed... URL: From randy7771026 at gmail.com Mon Aug 24 17:08:13 2015 From: randy7771026 at gmail.com (Randy Baxley) Date: Mon, 24 Aug 2015 10:08:13 -0500 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: <50869A74BA4F07468AD797C9BFF1FE3E0D96A3C6@A0185-XPO1026-C.ad.allstate.com> Message-ID: I will second the recommendation: A good resource for HTML, CSS and javascript is the W3Schools ( http://www.w3schools.com/) that have both tutorial and reference material available for free. With the addition of the same track in https://www.codecademy.com/ while using w3school as your referance material. In the same way I enjoyed my path to this information which is presented in http://randy7771026.wix.com/codepath and using https://www.python.org/doc/ as your referance source. In addition you might enjoy: https://www.coursera.org/course/interactivepython1 On Mon, Aug 24, 2015 at 6:35 AM, Valentina Kibuyaga wrote: > Kudos Phil! > > Excellent advice and ABSOLUTELY correct! > > ABSOLUTE being the key word! > > Valentina Kibuyaga > > ------------------------------ > From: proba at allstate.com > To: chicago at python.org > Date: Fri, 21 Aug 2015 21:38:21 +0000 > Subject: Re: [Chicago] New to python : Suggestions > > I guess the question is what exactly are you trying to learn? > > > > Learning Python is not that hard if you already know how to program. > Learning to program (well) takes study, practice and time. Learning web > programming in python is not too hard if already know web programming. > Based upon your requirements you will need to pick your web framework ? > Web2Py, Pyramid, Flask and Django are all alternatives. If you don?t > already do web programming you will also have to learn HTML, CSS, and basic > javascript programming. If you want to do anything modern looking you will > also have to master one or more javascript libraries like jQuery. Be > prepared, I think this journey will take you at least a year of hard work > before you have learned enough to code your idea to a level where you will > be ready to show it off. > > > > A good resource for HTML, CSS and javascript is the W3Schools ( > http://www.w3schools.com/) that have both tutorial and reference material > available for free. > > > > Finally, if what you want to do is not really learn web programming, but > instead you want to start a business based on your idea, there is a whole > other set of skills you will need dealing with business and > entrepreneurship. If you want to go that route the first test of your > skills is extracting enough investment money from friends and family to pay > a programmer who has already gone through the learning programming path and > is willing to partner with you to create your initial demo. > > > > Phil Robare > > > > *From:* Chicago [mailto:chicago-bounces+proba=allstate.com at python.org] *On > Behalf Of *Aswin kumar > *Sent:* Friday, August 21, 2015 1:05 PM > *To:* chicago at python.org > *Subject:* [Chicago] New to python : Suggestions > > > > Hi Folks, > > > > I am new to python programming language and I would like to learn web > programming in python.I have an idea(borrowing some ideas from Reddit) and > I want to implement the idea in Python.I have started with the online > edition of "Learn Python the hard way". Could anybody suggest me good > resources for web programming in python? > > > > > > Also May I know when and where could be the next possible meet? > > > > Regards, > > Aswin. > > _______________________________________________ Chicago mailing list > Chicago at python.org https://mail.python.org/mailman/listinfo/chicago > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Mon Aug 24 18:40:52 2015 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 24 Aug 2015 09:40:52 -0700 Subject: [Chicago] New to python : Suggestions In-Reply-To: References: <50869A74BA4F07468AD797C9BFF1FE3E0D96A3C6@A0185-XPO1026-C.ad.allstate.com> Message-ID: > > In the same way I enjoyed my path to this information which is presented > in > > http://randy7771026.wix.com/codepath > > and using https://www.python.org/doc/ as your referance source. > These docs are great. I was just re-reading Unicode history as 'splained in the docs and found them really fluent. https://docs.python.org/3/howto/unicode.html Speaking of fluent, the new title Fluent Python by Luciano Ramalho was just coming out this OSCON and I got a preview, and attended both of his talks. Now I'm reading a complete first edition and finding it well done. Fluent Python is great for someone with a working knowledge of Python but maybe learned in a hurry (easy to get productive quickly) and now ready for a next layer of proficiency. Kirby My thumbs up for the book (still only part way through) on the Portland Python User Group list: https://mail.python.org/pipermail/portland/2015-August/001710.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From d-lewit at neiu.edu Thu Aug 27 10:50:16 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Thu, 27 Aug 2015 03:50:16 -0500 Subject: [Chicago] Who suggested that I study Ocaml? Message-ID: Hey guys and gals in Python Land: Most everyone on the list is going to think I'm nuts! About a month ago someone suggested that I study Ocaml. Was it Phil Robare? Well, anyhow I accepted the challenge and for the past few weeks I've been diving headfirst into the world of Ocaml. Interesting! And now I really DO appreciate the elegant simplicity of Python! That being said I'm kind of happy with some of my work in Ocaml. If you have access to the Ocaml compiler--and if you care--if you don't, no sweat!, then you might want to check out these files. Just a heads up. Formatter.ml is a module that contains functions used by Mortgage_Calculator.ml, so you would have to compile Formatter.ml first and then compile Mortgage_Calculator.ml. Also, when the program asks for a "tolerance", I suggest entering a value between 0.20 and 1.00, your choice. DO NOT enter a value less than 0.10 because then the program might crash. The mortgage payment is found recursively, starting with the assumption that your payment is ( interest rate as a decimal ) * ( amount borrowed ). This is always an underestimate of course. The function calls itself repeated until finally the remaining balance is very, very close to 0. It will never be exactly 0 however because of the limitations of floating point arithmetic. Therefore, I require the end user to enter a tolerance. If you owe 20 cents on your mortgage at the very end, then hey, that's pretty darn good! That's extremely close to 0, especially if you borrowed $400,000 to buy your condo or house. In some cases the recursion is a wee bit slow, so give your computer about a minute or so to figure it out. I wouldn't mind trying this in Python as well, but I've noticed that algorithms that are intensively recursive can be very slow in Python. Supposedly (according to my reading on the subject) functional languages such as Standard ML, Ocaml and Haskell are usually pretty strong when it comes to quickly implementing recursive functions. What's the reason for that? I have no clue! If you're not interested in Ocaml, no sweat! Just delete the email! Oh yes.... I was fishing around in my file system and noticed something kind of weird. I have files with the name "Ocaml" in them, but they have a .py extension! So.... not sure what that means. I guess Ocaml can call Python commands or maybe Python can call Ocaml commands? Kind of interesting! Thanks, Douglas. P.S. I believe these are the correct linking and compiling commands in Terminal. (Did this with a Mac that has the Ocaml compiler installed on it. ) ocamlopt -c Formatter.ml ocamlopt Formatter.cmx unix.cmxa -o Mortgage_Calculator Mortgage_Calculator.ml That should work, I hope! -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Formatter.ml Type: application/octet-stream Size: 2268 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Mortgage_Calculator.ml Type: application/octet-stream Size: 2849 bytes Desc: not available URL: From zitterbewegung at gmail.com Thu Aug 27 13:34:26 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Thu, 27 Aug 2015 11:34:26 +0000 Subject: [Chicago] Who suggested that I study Ocaml? In-Reply-To: References: Message-ID: I don't understand how this is on topic for the list? On Thu, Aug 27, 2015 at 4:19 AM Lewit, Douglas wrote: > Hey guys and gals in Python Land: > > Most everyone on the list is going to think I'm nuts! About a month ago > someone suggested that I study Ocaml. Was it Phil Robare? Well, anyhow I > accepted the challenge and for the past few weeks I've been diving > headfirst into the world of Ocaml. Interesting! And now I really DO > appreciate the elegant simplicity of Python! That being said I'm kind of > happy with some of my work in Ocaml. If you have access to the Ocaml > compiler--and if you care--if you don't, no sweat!, then you might want to > check out these files. Just a heads up. Formatter.ml is a module that > contains functions used by Mortgage_Calculator.ml, so you would have to > compile Formatter.ml first and then compile Mortgage_Calculator.ml. Also, > when the program asks for a "tolerance", I suggest entering a value between > 0.20 and 1.00, your choice. DO NOT enter a value less than 0.10 because > then the program might crash. The mortgage payment is found recursively, > starting with the assumption that your payment is ( interest rate as a > decimal ) * ( amount borrowed ). This is always an underestimate of > course. The function calls itself repeated until finally the remaining > balance is very, very close to 0. It will never be exactly 0 however > because of the limitations of floating point arithmetic. Therefore, I > require the end user to enter a tolerance. If you owe 20 cents on your > mortgage at the very end, then hey, that's pretty darn good! That's > extremely close to 0, especially if you borrowed $400,000 to buy your condo > or house. In some cases the recursion is a wee bit slow, so give your > computer about a minute or so to figure it out. > > I wouldn't mind trying this in Python as well, but I've noticed that > algorithms that are intensively recursive can be very slow in Python. > Supposedly (according to my reading on the subject) functional languages > such as Standard ML, Ocaml and Haskell are usually pretty strong when it > comes to quickly implementing recursive functions. What's the reason for > that? I have no clue! > > If you're not interested in Ocaml, no sweat! Just delete the email! Oh > yes.... I was fishing around in my file system and noticed something kind > of weird. I have files with the name "Ocaml" in them, but they have a .py > extension! So.... not sure what that means. I guess Ocaml can call Python > commands or maybe Python can call Ocaml commands? Kind of interesting! > > Thanks, > > Douglas. > > P.S. I believe these are the correct linking and compiling commands in > Terminal. (Did this with a Mac that has the Ocaml compiler installed on > it. ) > > ocamlopt -c Formatter.ml > > ocamlopt Formatter.cmx unix.cmxa -o Mortgage_Calculator > Mortgage_Calculator.ml > > That should work, I hope! > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > -------------- next part -------------- An HTML attachment was scrubbed... URL: From osiddique at gmail.com Thu Aug 27 14:37:17 2015 From: osiddique at gmail.com (Osman Siddique) Date: Thu, 27 Aug 2015 07:37:17 -0500 Subject: [Chicago] Who suggested that I study Ocaml? In-Reply-To: References: Message-ID: "If you're not interested in Ocaml, no sweat! Just delete the email!" next time, maybe put this at the top of the email instead of the third paragraph. On Thu, Aug 27, 2015 at 6:34 AM, Joshua Herman wrote: > I don't understand how this is on topic for the list? > On Thu, Aug 27, 2015 at 4:19 AM Lewit, Douglas wrote: > >> Hey guys and gals in Python Land: >> >> Most everyone on the list is going to think I'm nuts! About a month ago >> someone suggested that I study Ocaml. Was it Phil Robare? Well, anyhow I >> accepted the challenge and for the past few weeks I've been diving >> headfirst into the world of Ocaml. Interesting! And now I really DO >> appreciate the elegant simplicity of Python! That being said I'm kind of >> happy with some of my work in Ocaml. If you have access to the Ocaml >> compiler--and if you care--if you don't, no sweat!, then you might want to >> check out these files. Just a heads up. Formatter.ml is a module that >> contains functions used by Mortgage_Calculator.ml, so you would have to >> compile Formatter.ml first and then compile Mortgage_Calculator.ml. Also, >> when the program asks for a "tolerance", I suggest entering a value between >> 0.20 and 1.00, your choice. DO NOT enter a value less than 0.10 because >> then the program might crash. The mortgage payment is found recursively, >> starting with the assumption that your payment is ( interest rate as a >> decimal ) * ( amount borrowed ). This is always an underestimate of >> course. The function calls itself repeated until finally the remaining >> balance is very, very close to 0. It will never be exactly 0 however >> because of the limitations of floating point arithmetic. Therefore, I >> require the end user to enter a tolerance. If you owe 20 cents on your >> mortgage at the very end, then hey, that's pretty darn good! That's >> extremely close to 0, especially if you borrowed $400,000 to buy your condo >> or house. In some cases the recursion is a wee bit slow, so give your >> computer about a minute or so to figure it out. >> >> I wouldn't mind trying this in Python as well, but I've noticed that >> algorithms that are intensively recursive can be very slow in Python. >> Supposedly (according to my reading on the subject) functional languages >> such as Standard ML, Ocaml and Haskell are usually pretty strong when it >> comes to quickly implementing recursive functions. What's the reason for >> that? I have no clue! >> >> If you're not interested in Ocaml, no sweat! Just delete the email! Oh >> yes.... I was fishing around in my file system and noticed something kind >> of weird. I have files with the name "Ocaml" in them, but they have a .py >> extension! So.... not sure what that means. I guess Ocaml can call Python >> commands or maybe Python can call Ocaml commands? Kind of interesting! >> >> Thanks, >> >> Douglas. >> >> P.S. I believe these are the correct linking and compiling commands in >> Terminal. (Did this with a Mac that has the Ocaml compiler installed on >> it. ) >> >> ocamlopt -c Formatter.ml >> >> ocamlopt Formatter.cmx unix.cmxa -o Mortgage_Calculator >> Mortgage_Calculator.ml >> >> That should work, I hope! >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Thu Aug 27 16:14:59 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Thu, 27 Aug 2015 09:14:59 -0500 Subject: [Chicago] Who suggested that I study Ocaml? In-Reply-To: References: Message-ID: Thats not the point I am trying to make. The purpose of the list is to discuss python. The email that the person sent looks like an advertisement for ocaml. There are other mailing lists to allow for general discussion about programming languages. This is the only paragraph about python "I wouldn't mind trying this in Python as well, but I've noticed that algorithms that are intensively recursive can be very slow in Python. Supposedly (according to my reading on the subject) functional languages such as Standard ML, Ocaml and Haskell are usually pretty strong when it comes to quickly implementing recursive functions. What's the reason for that? I have no clue!" On Thu, Aug 27, 2015 at 7:37 AM, Osman Siddique wrote: > "If you're not interested in Ocaml, no sweat! Just delete the email!" > > next time, maybe put this at the top of the email instead of the third > paragraph. > > On Thu, Aug 27, 2015 at 6:34 AM, Joshua Herman > wrote: > >> I don't understand how this is on topic for the list? >> On Thu, Aug 27, 2015 at 4:19 AM Lewit, Douglas wrote: >> >>> Hey guys and gals in Python Land: >>> >>> Most everyone on the list is going to think I'm nuts! About a month ago >>> someone suggested that I study Ocaml. Was it Phil Robare? Well, anyhow I >>> accepted the challenge and for the past few weeks I've been diving >>> headfirst into the world of Ocaml. Interesting! And now I really DO >>> appreciate the elegant simplicity of Python! That being said I'm kind of >>> happy with some of my work in Ocaml. If you have access to the Ocaml >>> compiler--and if you care--if you don't, no sweat!, then you might want to >>> check out these files. Just a heads up. Formatter.ml is a module that >>> contains functions used by Mortgage_Calculator.ml, so you would have to >>> compile Formatter.ml first and then compile Mortgage_Calculator.ml. Also, >>> when the program asks for a "tolerance", I suggest entering a value between >>> 0.20 and 1.00, your choice. DO NOT enter a value less than 0.10 because >>> then the program might crash. The mortgage payment is found recursively, >>> starting with the assumption that your payment is ( interest rate as a >>> decimal ) * ( amount borrowed ). This is always an underestimate of >>> course. The function calls itself repeated until finally the remaining >>> balance is very, very close to 0. It will never be exactly 0 however >>> because of the limitations of floating point arithmetic. Therefore, I >>> require the end user to enter a tolerance. If you owe 20 cents on your >>> mortgage at the very end, then hey, that's pretty darn good! That's >>> extremely close to 0, especially if you borrowed $400,000 to buy your condo >>> or house. In some cases the recursion is a wee bit slow, so give your >>> computer about a minute or so to figure it out. >>> >>> I wouldn't mind trying this in Python as well, but I've noticed that >>> algorithms that are intensively recursive can be very slow in Python. >>> Supposedly (according to my reading on the subject) functional languages >>> such as Standard ML, Ocaml and Haskell are usually pretty strong when it >>> comes to quickly implementing recursive functions. What's the reason for >>> that? I have no clue! >>> >>> If you're not interested in Ocaml, no sweat! Just delete the email! Oh >>> yes.... I was fishing around in my file system and noticed something kind >>> of weird. I have files with the name "Ocaml" in them, but they have a .py >>> extension! So.... not sure what that means. I guess Ocaml can call Python >>> commands or maybe Python can call Ocaml commands? Kind of interesting! >>> >>> Thanks, >>> >>> Douglas. >>> >>> P.S. I believe these are the correct linking and compiling commands in >>> Terminal. (Did this with a Mac that has the Ocaml compiler installed on >>> it. ) >>> >>> ocamlopt -c Formatter.ml >>> >>> ocamlopt Formatter.cmx unix.cmxa -o Mortgage_Calculator >>> Mortgage_Calculator.ml >>> >>> That should work, I hope! >>> _______________________________________________ >>> Chicago mailing list >>> Chicago at python.org >>> https://mail.python.org/mailman/listinfo/chicago >>> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From d-lewit at neiu.edu Thu Aug 27 18:17:57 2015 From: d-lewit at neiu.edu (Lewit, Douglas) Date: Thu, 27 Aug 2015 11:17:57 -0500 Subject: [Chicago] Who suggested that I study Ocaml? In-Reply-To: References: Message-ID: Sometimes Josh you gotta visit other cities in order to fully appreciate where you live! No, not an advertisement for Ocaml! That's not my purpose. But I think it's useful to take a peek at other programming languages, especially since Python is often called upon to glue together apps written in other languages. On Thu, Aug 27, 2015 at 9:14 AM, Joshua Herman wrote: > Thats not the point I am trying to make. The purpose of the list is to > discuss python. The email that the person sent looks like an advertisement > for ocaml. There are other mailing lists to allow for general discussion > about programming languages. > > This is the only paragraph about python > > "I wouldn't mind trying this in Python as well, but I've noticed that > algorithms that are intensively recursive can be very slow in Python. > Supposedly (according to my reading on the subject) functional languages > such as Standard ML, Ocaml and Haskell are usually pretty strong when it > comes to quickly implementing recursive functions. What's the reason for > that? I have no clue!" > > > On Thu, Aug 27, 2015 at 7:37 AM, Osman Siddique > wrote: > >> "If you're not interested in Ocaml, no sweat! Just delete the email!" >> >> next time, maybe put this at the top of the email instead of the third >> paragraph. >> >> On Thu, Aug 27, 2015 at 6:34 AM, Joshua Herman >> wrote: >> >>> I don't understand how this is on topic for the list? >>> On Thu, Aug 27, 2015 at 4:19 AM Lewit, Douglas wrote: >>> >>>> Hey guys and gals in Python Land: >>>> >>>> Most everyone on the list is going to think I'm nuts! About a month >>>> ago someone suggested that I study Ocaml. Was it Phil Robare? Well, >>>> anyhow I accepted the challenge and for the past few weeks I've been diving >>>> headfirst into the world of Ocaml. Interesting! And now I really DO >>>> appreciate the elegant simplicity of Python! That being said I'm kind of >>>> happy with some of my work in Ocaml. If you have access to the Ocaml >>>> compiler--and if you care--if you don't, no sweat!, then you might want to >>>> check out these files. Just a heads up. Formatter.ml is a module that >>>> contains functions used by Mortgage_Calculator.ml, so you would have to >>>> compile Formatter.ml first and then compile Mortgage_Calculator.ml. Also, >>>> when the program asks for a "tolerance", I suggest entering a value between >>>> 0.20 and 1.00, your choice. DO NOT enter a value less than 0.10 because >>>> then the program might crash. The mortgage payment is found recursively, >>>> starting with the assumption that your payment is ( interest rate as a >>>> decimal ) * ( amount borrowed ). This is always an underestimate of >>>> course. The function calls itself repeated until finally the remaining >>>> balance is very, very close to 0. It will never be exactly 0 however >>>> because of the limitations of floating point arithmetic. Therefore, I >>>> require the end user to enter a tolerance. If you owe 20 cents on your >>>> mortgage at the very end, then hey, that's pretty darn good! That's >>>> extremely close to 0, especially if you borrowed $400,000 to buy your condo >>>> or house. In some cases the recursion is a wee bit slow, so give your >>>> computer about a minute or so to figure it out. >>>> >>>> I wouldn't mind trying this in Python as well, but I've noticed that >>>> algorithms that are intensively recursive can be very slow in Python. >>>> Supposedly (according to my reading on the subject) functional languages >>>> such as Standard ML, Ocaml and Haskell are usually pretty strong when it >>>> comes to quickly implementing recursive functions. What's the reason for >>>> that? I have no clue! >>>> >>>> If you're not interested in Ocaml, no sweat! Just delete the email! >>>> Oh yes.... I was fishing around in my file system and noticed something >>>> kind of weird. I have files with the name "Ocaml" in them, but they have a >>>> .py extension! So.... not sure what that means. I guess Ocaml can call >>>> Python commands or maybe Python can call Ocaml commands? Kind of >>>> interesting! >>>> >>>> Thanks, >>>> >>>> Douglas. >>>> >>>> P.S. I believe these are the correct linking and compiling commands in >>>> Terminal. (Did this with a Mac that has the Ocaml compiler installed on >>>> it. ) >>>> >>>> ocamlopt -c Formatter.ml >>>> >>>> ocamlopt Formatter.cmx unix.cmxa -o Mortgage_Calculator >>>> Mortgage_Calculator.ml >>>> >>>> That should work, I hope! >>>> _______________________________________________ >>>> Chicago mailing list >>>> Chicago at python.org >>>> https://mail.python.org/mailman/listinfo/chicago >>>> >>> >>> _______________________________________________ >>> Chicago mailing list >>> Chicago at python.org >>> https://mail.python.org/mailman/listinfo/chicago >>> >>> >> >> _______________________________________________ >> Chicago mailing list >> Chicago at python.org >> https://mail.python.org/mailman/listinfo/chicago >> >> > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at imagescape.com Fri Aug 28 00:50:37 2015 From: brian at imagescape.com (Brian Moloney) Date: Thu, 27 Aug 2015 17:50:37 -0500 Subject: [Chicago] Chicago Djangonauts meetup Sep 3 @ Braintree Message-ID: September 3, 2015 @ 6:30pm - Braintree at 222 Merchandise Mart Plaza So far... Jonathan Bisson - Django-based Autocompl... (looking for a couple more. If interested, send me an email: brian at imagescape.com) RSVP (Facebook preferred with alternative offered for non-Facebookers): https://www.facebook.com/events/833061880141879/ http://www.chicagodjango.com and use the Contact Us form on the homepage footer. Brian Moloney From joe.jasinski at gmail.com Fri Aug 28 05:04:27 2015 From: joe.jasinski at gmail.com (Joe Jasinski) Date: Thu, 27 Aug 2015 22:04:27 -0500 Subject: [Chicago] ChiPy Call for September 10th Meeting Speakers Message-ID: Hi all, ChiPy is gearing up for its September 10th meeting and we are looking for people interested in presenting. We are eager to hear you speak at ChiPy about your favorite Python-related topics. It's a great opportunity to share what you know and give back to the Python community. If you'd like to submit a topic, you can reply to this email or email me at directly joe.jasinski at gmail.com. At some point, we'll need you to fill out the talk proposal form so we can get your talk on the schedule. http://www.chipy.org/meetings/topics/propose Let me know if you have any questions, and hope to hear from you soon! If you'd like to attend the next meeting, you can rsvp at chipy.org or via our Meetup group. Joe -- Joe J. Jasinski www.joejasinski.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From shekay at pobox.com Fri Aug 28 16:38:13 2015 From: shekay at pobox.com (sheila miguez) Date: Fri, 28 Aug 2015 09:38:13 -0500 Subject: [Chicago] Python 101 notebook on try.jupyter.org Message-ID: Hi all, The other day I was talking to Tanya and she pointed me to a Python 101 notebook in try.jupyter.org that she worked on for PyLadies. You can reach it by navigating to https://try.jupyter.org/ and then clicking through "communities/pyladies". The notebook is Python 101.ipynb. It's pretty cool. I projected it at python office hours. It's written following from discussions in a paper on lessons learned from teaching python to geophysics students I think? I may be mis-remembering that part. -- shekay at pobox.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Fri Aug 28 17:48:27 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Fri, 28 Aug 2015 10:48:27 -0500 Subject: [Chicago] Python 101 notebook on try.jupyter.org In-Reply-To: References: Message-ID: On Fri, Aug 28, 2015 at 9:38 AM, sheila miguez wrote: > https://try.jupyter.org/ Dear Shelia, This is really cool. I wonder if you could paste in the deep dreaming stuff into this. Sincerely, Joshua Herman -------------- next part -------------- An HTML attachment was scrubbed... URL: From shekay at pobox.com Fri Aug 28 17:53:46 2015 From: shekay at pobox.com (sheila miguez) Date: Fri, 28 Aug 2015 10:53:46 -0500 Subject: [Chicago] Python 101 notebook on try.jupyter.org In-Reply-To: References: Message-ID: On Fri, Aug 28, 2015 at 10:48 AM, Joshua Herman wrote: > On Fri, Aug 28, 2015 at 9:38 AM, sheila miguez wrote: > >> https://try.jupyter.org/ > > > Dear Shelia, > This is really cool. I wonder if you could paste in the deep dreaming > stuff into this. > Sincerely, > Joshua Herman > I've only looked at deep dreaming pictures and not the algorithms. I'd have to cheat and load an image. But maybe someone could implement it all in a notebook to generate real images. That would be cool. -- shekay at pobox.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From zitterbewegung at gmail.com Fri Aug 28 18:40:43 2015 From: zitterbewegung at gmail.com (Joshua Herman) Date: Fri, 28 Aug 2015 11:40:43 -0500 Subject: [Chicago] Python 101 notebook on try.jupyter.org In-Reply-To: References: Message-ID: Actually now that i remember it is in a notebook. Google hosts one on github. https://github.com/google/deepdream I think we should do like a pyladies event about this if we can get it working. On Fri, Aug 28, 2015 at 10:53 AM, sheila miguez wrote: > > On Fri, Aug 28, 2015 at 10:48 AM, Joshua Herman > wrote: > >> On Fri, Aug 28, 2015 at 9:38 AM, sheila miguez wrote: >> >>> https://try.jupyter.org/ >> >> >> Dear Shelia, >> This is really cool. I wonder if you could paste in the deep dreaming >> stuff into this. >> Sincerely, >> Joshua Herman >> > > > I've only looked at deep dreaming pictures and not the algorithms. I'd > have to cheat and load an image. But maybe someone could implement it all > in a notebook to generate real images. That would be cool. > > > -- > shekay at pobox.com > > _______________________________________________ > Chicago mailing list > Chicago at python.org > https://mail.python.org/mailman/listinfo/chicago > > -------------- next part -------------- An HTML attachment was scrubbed... URL: