From kirby.urner at gmail.com Fri Feb 4 21:10:37 2011 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 4 Feb 2011 12:10:37 -0800 Subject: [Edu-sig] Mosaics using Python... Message-ID: """ Mosaics using Python generators... by K. Urner 4dsolutions.net based on a thread on mathfuture: http://groups.google.com/group/mathfuture/msg/9d098696c2ea7426?hl=en Just as the Fibonacci sequence generator might be "seeded" by any two integers to start off, so might Pascal's Triangle be seeded with any beginning row. When these sequences are formed into tabular or other areal displays, such that information may be gleaned from rows and columns, these formats may be called "mosaics" in some of the literature. """ def fibonacci( a=0, b=1): """ Generator for a Fibonacci sequence starting from any two integers See: Online Encyclopedia of Integer Sequences http://oeis.org/A000045 >>> gen = fibonacci() >>> [next(gen) for i in range(11)] [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55] >>> gen = fibonacci(-1, 2) >>> [next(gen) for i in range(11)] [-1, 2, 1, 3, 4, 7, 11, 18, 29, 47, 76] """ while True: yield a b, a = a + b, b def pascal( therow = [1]): """ Generator for Pascal's Triangle starting from any top row Enter list for top row See: Number Mosaics by Adi R. Kanga (pg. 29, Fig 20) http://bit.ly/gDmmAo >>> gen = pascal([15, 20, 6]) >>> next(gen) [15, 20, 6] >>> next(gen) [15, 35, 26, 6] >>> next(gen) [15, 50, 61, 32, 6] >>> next(gen) [15, 65, 111, 93, 38, 6] >>> next(gen) [15, 80, 176, 204, 131, 44, 6] >>> next(gen) [15, 95, 256, 380, 335, 175, 50, 6] """ while True: yield therow therow = [ i + j for i, j in zip(therow + [0], [0] + therow) ] def _test(): import doctest doctest.testmod() if __name__ == "__main__": _test() -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Fri Feb 4 22:36:07 2011 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 4 Feb 2011 13:36:07 -0800 Subject: [Edu-sig] re Python's "batteries included" meme Message-ID: As I watch students struggle with the: if __name__ == "__main__": concept (where to put it, what it does), it occurs to me we could be doing more to leverage the already well-worn "batteries included." What's different about Python? The rich libraries it comes with, including a cross-platform GUI IDE. That's one meaning of "batteries included". But in another sense we could speak of the generic module as a "battery" with the "if run top-level" logic having to do with battery *testing*. ==== python module ==== [ BATTERIES ] (functions, classes, global-to-module names...) if __name__ == "__main__": [ BATTERY TESTERS ] ==================== That changes the meaning a little more, to where each Python module is like "a battery pack" with its own set of "testers". One thing we do with battery packs is we "import" (promote) their internals within a top-level namespace that starts off in some other (alien) module. Another thing we do with battery packs is run them top-level namespaces on their own, perhaps depending on imports (outsourced resources). I'm not suggesting harping on this too much, just another slide that goes by, but a fun mnemonic, and reinforcing of an already approved / useful design pattern (see my previous post in this edu-sig archive for an example of this self-testing style, relying on doctest for services). Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From calcpage at aol.com Mon Feb 7 02:48:13 2011 From: calcpage at aol.com (A. Jorge Garcia) Date: Sun, 06 Feb 2011 20:48:13 -0500 Subject: [Edu-sig] NEW: Blogs, Videos and Donorschoose! In-Reply-To: References: Message-ID: <8CD948035BEAA47-1744-230AB@webmail-d146.sysops.aol.com> NEW: Blogs, Videos and Donorschoose! Please enjoy my blogs on Midterm Week (installing SAGE and Ubuntu) and Course Selection Week (Recruiting for next year)! http://shadowfaxrant.blogspot.com Here's some new Algebra II Trig and preCalculus related screen-casts (Law of Sines, Law of Cosines)! http://www.youtube.com/calcpage2009 Take a look at my latest DonorsChoose project (new Tablet PC for SmartBoarding and ScreenCasting)! http://www.donorschoose.org/donors/proposal.html?id=520470&challengeid=32688&more=true HTH, A. Jorge Garcia Applied Math and CompSci http://shadowfaxrant.blogspot.com http://www.youtube.com/calcpage2009 From kirby.urner at gmail.com Mon Feb 7 09:54:30 2011 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 7 Feb 2011 00:54:30 -0800 Subject: [Edu-sig] NEW: Blogs, Videos and Donorschoose! In-Reply-To: <8CD948035BEAA47-1744-230AB@webmail-d146.sysops.aol.com> References: <8CD948035BEAA47-1744-230AB@webmail-d146.sysops.aol.com> Message-ID: On Sun, Feb 6, 2011 at 5:48 PM, A. Jorge Garcia wrote: > NEW: Blogs, Videos and Donorschoose! > > Please enjoy my blogs on Midterm Week (installing SAGE and Ubuntu) and > Course Selection Week (Recruiting for next year)! > http://shadowfaxrant.blogspot.com > > FLOSS = Free Linux Open Source Software? Hadn't heard that, clever. I like the stuff on primes in SAGE. Does SAGE let us do generators? No doubt. Projected Python: http://www.flickr.com/photos/17157315 at N00/5419722514/in/photostream/ http://www.flickr.com/photos/17157315 at N00/5419119093/in/photostream/ http://www.flickr.com/photos/17157315 at N00/5419125705/in/photostream/ http://www.flickr.com/photos/17157315 at N00/5419755072/in/photostream/ > Here's some new Algebra II Trig and preCalculus related screen-casts (Law > of Sines, Law of Cosines)! > http://www.youtube.com/calcpage2009 > > Eew, a calculator. No wait, I'm trying to be pro calculator these days: http://groups.google.com/group/mathfuture/msg/a3b22bd4f2255ac9?hl=en http://groups.google.com/group/mathfuture/browse_thread/thread/bd7ee358e7d1c4d8?hl=en (suggests emulating calculators as a premier genre when learning to program) http://xkcd.com/768/ > Take a look at my latest DonorsChoose project (new Tablet PC for > SmartBoarding and ScreenCasting)! > > http://www.donorschoose.org/donors/proposal.html?id=520470&challengeid=32688&more=true > > Very enterprising and good for showing off software designed to power charitable giving, something I think about a lot vis-a-vis my "Coffee Shops Network" (featuring games that let you be a hero, winning funds for worthy charities -- your donor profile may become a walking-your-talk credential of sorts). Kirby > HTH, > A. Jorge Garcia > Applied Math and CompSci > http://shadowfaxrant.blogspot.com > http://www.youtube.com/calcpage2009 > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Thu Feb 10 09:17:36 2011 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 10 Feb 2011 00:17:36 -0800 Subject: [Edu-sig] polystuff.py Message-ID: """ polystuff.py (Python 3.x) For a curriculum segment when we're not yet wanting to build user-defined classes. showpoly -- return an evaluable string with x the variable evalpoly -- return a numeric result given an evaluable string and x's value multipoly -- return the product of two polynomials as a tuple of tuples """ from operator import itemgetter def showpoly(A): """ Return a close-to-classic polynomial as an evaluable Python string literal, given a sequence of tuples for input (see multipoly below). Some prettifying. >>> p1 = ((4,2),(-4,1),(-7,0)) >>> showpoly(p1) '4 * x**2 - 4 * x**1 - 7' """ terms = [] for coeff, exp in sorted(A, key=itemgetter(1), reverse=True): terms.append( "{sign} {coeff}{var}".format( sign = "+" if coeff > 0 else "-", coeff = abs(coeff), var = ' * x**{}'.format(exp) if exp>0 else "" )) ans = " ".join(terms) if ans[0] == "+": # prettify ans = ans[1:].strip() return ans def evalpoly(strpoly, x): """ Evaluates a polynomial string literal for a given x value >>> p1 = ((4,2),(-4,1),(-7,0)) >>> thestring = showpoly(p1) >>> thestring '4 * x**2 - 4 * x**1 - 7' >>> evalpoly(thestring, 10) 353 """ return eval(strpoly, {"x":x}) def multipoly(A, B): """ Multiply two polynomials, represented as sequences of tuples e.g.: 3*x**3 + 2*x**2 - x - 1 would be ((3,3),(2,2),(-1,1),(-1,0)) with internal pairs in any order (term order is arbitrary) >>> p1 = ((1,1),(-1,0)) >>> p2 = ((1,1),(1,0)) >>> multipoly(p1,p2) [(-1, 0), (1, 2)] >>> p1 = ((4,2),(-4,1),(-7,0)) >>> p2 = ((1,1),(3,0)) >>> multipoly(p1,p2) [(-21, 0), (-19, 1), (8, 2), (4, 3)] """ results = [] termsAB = [] # Cartesian product of terms in poly A and poly B # multiply coefficients, add exponents for termA in A: for termB in B: termsAB.append(( termA[0] * termB[0], # coefficients termA[1] + termB[1] # exponents )) # find maximum exponent degree = max([term[1] for term in termsAB]) # collect like terms (same exponent) for exp in range(degree+1): # from 0 to degree inclusive newterm = ( sum([term[0] for term in termsAB if term[1] == exp]), exp) if newterm[0] != 0: results.append(newterm) return results def _test( ): import doctest doctest.testmod() if __name__ == '__main__': _test() -------------- next part -------------- An HTML attachment was scrubbed... URL: From ufkapano at gmail.com Thu Feb 10 12:17:51 2011 From: ufkapano at gmail.com (Andrzej Kapanowski) Date: Thu, 10 Feb 2011 12:17:51 +0100 Subject: [Edu-sig] polystuff.py In-Reply-To: References: Message-ID: Hello! Here is my representation of polynomials in Python as dictionaries. zero = {} one = {0:1} two = {0:2} x = {1:1} x2 = {2:1} # x^2 poly = {2:3, 1:4, 0:5} # 3*x^2 + 4*x + 5 # Some functions... def add_poly(poly1, poly2): # w1(x)+w2(x) tmp = dict(poly1) for k in poly2: tmp[k] = tmp.get(k,0) + poly2[k] if tmp[k] == 0: del tmp[k] return tmp def times_poly(number, poly): # n*w(x) if number == 0: return {} tmp = {} for k in poly: tmp[k] = number*poly[k] return tmp def mul_poly(poly1, poly2): # w1(x)*w2(x) tmp = {} for i in poly1: for j in poly2: tmp[i+j] = tmp.get(i+j,0) + poly1[i]*poly2[j] return tmp def diff_poly(poly): # [c*x^n]' = c*n*x^(n-1) tmp = {} for i in poly: tmp[i-1] = i*poly[i] if -1 in tmp: del tmp[-1] return tmp def eval_poly(poly, x): # w(x), Horner i = max(i for i in poly) p = poly[i] while i > 0: i = i-1 p = p * x + poly.get(i,0) return p def combine_poly(poly1, poly2): # w1(w2(x)), Horner i = max(k for k in poly1) tmp = {0:poly1[i]} while i > 0: i = i-1 tmp = add_poly(mul_poly(tmp, poly2), {0:poly1.get(i,0)}) return tmp def pow_poly(poly, n): # return combine_poly({n:1}, poly) tmp = {0:1} while n > 0: tmp = mul_poly(tmp, poly) n = n-1 return tmp Regards, Andrzej Kapanowski -------------- next part -------------- An HTML attachment was scrubbed... URL: From vceder at gmail.com Thu Feb 10 14:29:35 2011 From: vceder at gmail.com (Vern Ceder) Date: Thu, 10 Feb 2011 08:29:35 -0500 Subject: [Edu-sig] edu-sig @ PyCon Message-ID: Hi everyone, I'm just putting out the traditional "what to we want to do at PyCon?" feeler... They don't have the open space pages quite ready to go, but we can use the list to get started. In the past, we've gotten dinner one evening and then found an open space room to chat for a while... any thoughts? Cheers, Vern -- Vern Ceder vceder at gmail.com, vceder at dogsinmotion.com The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW From kirby.urner at gmail.com Fri Feb 11 17:56:07 2011 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 11 Feb 2011 08:56:07 -0800 Subject: [Edu-sig] polystuff.py In-Reply-To: References: Message-ID: I link back to our posts from here: http://mathforum.org/kb/message.jspa?messageID=7381491&tstart=0 The next turn of the spiral might involve taking such functions and making them methods of a Polynomial object. Example framework: http://www.4dsolutions.net/ocn/python/simppoly.py So you'd have operator overloading and write things like: >>> p1 = Poly( {2:3, 1:4, 0:5} ) >>> p2 = Poly( {1:1, 0:5} ) >>> p1**4 >>> p1 * p2 >>> p1 + p2 etc. Once you have polynomials as "math objects" you might compare them with other objects that also add, multiply etc. Questions about closure arise i.e. what operations might take you outside the Polynomial type for answers, etc. Kirby On Thu, Feb 10, 2011 at 3:17 AM, Andrzej Kapanowski wrote: > > Hello! > Here is my representation of polynomials in Python as dictionaries. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ajudkis at verizon.net Sat Feb 12 00:56:37 2011 From: ajudkis at verizon.net (Andy Judkis) Date: Fri, 11 Feb 2011 18:56:37 -0500 Subject: [Edu-sig] off-topic: teachable Moore's Law moment coming Message-ID: <4D55CCB5.4050802@verizon.net> This isn't Python-related, but things have been quiet here lately and I figure we can spare the bandwidth. . . I'm really excited about the upcoming Jeopardy! shows next week (Mon-Wed) with champion human players facing off against IBM's Watson. It's been a great opportunity to get students to think about what Moore's law means, and how computer technology is likely to affect their lives over the next few decades. Obviously the IBM hype machine is in overdrive, but I think they've earned the right. In my class, we were just discussing how chips are not getting faster these days because of thermal problems, but are still getting more powerful in their ability to do parallel computation, and what that means. IBM has a very good not-too-technical video on their site about how this applies to their system http://www-943.ibm.com/innovation/us/watson/what-is-watson/a-system-designed-for-answers.html There's also an episode of PBS's Nova about Watson that aired earlier this week, available on-line: http://www.pbs.org/wgbh/nova/tech/smartest-machine-on-earth.html I know that my kids are always surprised and excited to see stuff that we do in class have some relevance in the real world, and this is the best alignment I've ever encountered. Thanks, Andy From kirby.urner at gmail.com Sat Feb 12 07:53:24 2011 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 11 Feb 2011 22:53:24 -0800 Subject: [Edu-sig] Fwd: off-topic: teachable Moore's Law moment coming In-Reply-To: References: <4D55CCB5.4050802@verizon.net> Message-ID: ---------- Forwarded message ---------- From: kirby urner Date: Fri, Feb 11, 2011 at 10:53 PM Subject: Re: [Edu-sig] off-topic: teachable Moore's Law moment coming To: Andy Judkis I've been watching these videos hand bringing Watson up in conversation. This wasn't much talked about on other lists I'm following, so from my point of view, thanks for making edu-sig your geocache. Kirby On Fri, Feb 11, 2011 at 3:56 PM, Andy Judkis wrote: > This isn't Python-related, but things have been quiet here lately and I > figure we can spare the bandwidth. . . > > I'm really excited about the upcoming Jeopardy! shows next week (Mon-Wed) > with champion human players facing off against IBM's Watson. It's been a > great opportunity to get students to think about what Moore's law means, and > how computer technology is likely to affect their lives over the next few > decades. Obviously the IBM hype machine is in overdrive, but I think they've > earned the right. > > In my class, we were just discussing how chips are not getting faster these > days because of thermal problems, but are still getting more powerful in > their ability to do parallel computation, and what that means. IBM has a > very good not-too-technical video on their site about how this applies to > their system > http://www-943.ibm.com/innovation/us/watson/what-is-watson/a-system-designed-for-answers.html > > There's also an episode of PBS's Nova about Watson that aired earlier this > week, available on-line: > http://www.pbs.org/wgbh/nova/tech/smartest-machine-on-earth.html > > I know that my kids are always surprised and excited to see stuff that we > do in class have some relevance in the real world, and this is the best > alignment I've ever encountered. > > Thanks, > Andy > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.mascher at gmx.de Sat Feb 12 10:46:03 2011 From: christian.mascher at gmx.de (Christian Mascher) Date: Sat, 12 Feb 2011 10:46:03 +0100 Subject: [Edu-sig] off-topic: apropos Go In-Reply-To: <4D55CCB5.4050802@verizon.net> References: <4D55CCB5.4050802@verizon.net> Message-ID: <4D5656DB.7010006@gmx.de> Andy Judkis wrote: > I'm really excited about the upcoming Jeopardy! shows next week > (Mon-Wed) with champion human players facing off against IBM's Watson. > It's been a great opportunity to get students to think about what > Moore's law means, and how computer technology is likely to affect their > lives over the next few decades. Obviously the IBM hype machine is in > overdrive, but I think they've earned the right. > Haven't heard about Watson before. It seems to be a quiz solving machine. There is a long history of teaching computer to play the games of humans - and almost always the computers are beating us pretty soon. There still is one notable exception being the oriental game of Go. Creating a relatively strong playing programme has taken about 20 years longer than in the case of chess, and they still don't beat professional players on the standard (19x19) grid - not without a large handicap at least. Obviously pattern recognition and strategy of professional human players is still out of reach in this case. http://en.wikipedia.org/wiki/Computer_Go Interestingly the breakthrough achievement leading to todays much stronger programmes (only a couple of years back) did not come by mimicking human reasoning about the next move. Instead, the merit of a move is evaluated by a monte-carlo approach: The board is filled with random moves until the machine can tell who wins. This is repeated thousands of times and so by sheer statistics the relative value of the next move is assessed. This kind of evaluation process is absolutely not what a human player is doing or capable of doing in his head. So there is no hope of computers teaching us how to play better Go ;-), at least not in the sense of explaining to us why they made a certain move. Cheers Christian From mark.engelberg at gmail.com Sat Feb 12 23:10:36 2011 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Sat, 12 Feb 2011 14:10:36 -0800 Subject: [Edu-sig] off-topic: apropos Go In-Reply-To: <4D5656DB.7010006@gmx.de> References: <4D55CCB5.4050802@verizon.net> <4D5656DB.7010006@gmx.de> Message-ID: On Sat, Feb 12, 2011 at 1:46 AM, Christian Mascher wrote: > > > Interestingly the breakthrough achievement leading to todays much stronger > programmes (only a couple of years back) did not come by mimicking human > reasoning about the next move. Instead, the merit of a move is evaluated by > a monte-carlo approach: The board is filled with random moves until the > machine can tell who wins. This is repeated thousands of times and so by > sheer statistics the relative value of the next move is assessed. This kind > of evaluation process is absolutely not what a human player is doing or > capable of doing in his head. So there is no hope of computers teaching us > how to play better Go ;-), at least not in the sense of explaining to us why > they made a certain move. > > My understanding is that the strongest Go programs use the Monte Carlo method, evaluating the various moves against vast databases of past professional games. So they are not really mimicking human reasoning, but are "data mining" the wisdom of humans. The programs can report back some info about why they made a certain move, usually in the form of "this move was made in 60% of pro games in a similar position that eventually led to a win". In this sense, Go is proving to be a good example of the "new approach" to AI. For example, translation between foreign languages has undergone a similar revolution. 20 years ago, it was all about building expert systems with thousands of carefully crafted rules that capture the domain knowledge. These days, we just throw a large body of examples of human-translated documents at a data mining program, and let it work out new translations using statistical methods. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark.engelberg at gmail.com Sat Feb 12 23:15:22 2011 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Sat, 12 Feb 2011 14:15:22 -0800 Subject: [Edu-sig] back on topic: apropos Go Message-ID: Getting back on topic, there's a good Python book about this sort of "data mining" approach to AI with lots of great projects that are perfect for advanced students: http://www.amazon.com/Programming-Collective-Intelligence-Building-Applications/dp/0596529325/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sun Feb 13 00:41:53 2011 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 12 Feb 2011 15:41:53 -0800 Subject: [Edu-sig] back on topic: apropos Go In-Reply-To: References: Message-ID: Thx for this thread. One of my colleagues here in Portland taught himself geek skills from scratch and soon had his own buzzbot in the cloud, all written in Python and backending into MySQL. Beautifulsoup. Screen scraping, like skateboarding, is not a crime. I've suggested on this list that we co-develop such a buzzbot as one of the archetypal "learning projects". This involves registering as a dev with a search engine company (one or more) and accessing its API. There's some obvious division of labor in these kinds of apps. You need your web crawlers tagging sites based on preliminary tests, followed by data harvesters, various filters and cleaners. Then you'll want your scoring / grading algorithms (another kind of filtering), that applies more relevant tests, saves the rankings. Having all these facilities in open source Python, in however many versions, will continue to attract curious learners and clients for their services. Patrick is getting pinged by Hollywood deal pitchers looking for metrics in a mostly intuitive business. Kirby On Sat, Feb 12, 2011 at 2:15 PM, Mark Engelberg wrote: > Getting back on topic, there's a good Python book about this sort of "data > mining" approach to AI with lots of great projects that are perfect for > advanced students: > > > http://www.amazon.com/Programming-Collective-Intelligence-Building-Applications/dp/0596529325/ > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajeev.raizada at dartmouth.edu Thu Feb 17 21:46:44 2011 From: rajeev.raizada at dartmouth.edu (Rajeev Raizada) Date: Thu, 17 Feb 2011 15:46:44 -0500 Subject: [Edu-sig] Some interactive Python tutorials on basic stats, possibly useful for teaching In-Reply-To: References: Message-ID: Dear Python Edu-sig folks, Those of you whose duties include teaching basic stats might be interested in these interactive tutorial files, designed to illustrate basic concepts. Running the code opens up an interactive figure window. When you click on a figure to add new points, the statistical tests shown in the figure change accordingly. http://www.dartmouth.edu/~raj/intro-stats.html Here is a YouTube video showing the interactive demos in action: http://www.youtube.com/watch?v=nCv_MhaeFo8 The code has lots of comments in it, which attempt to explain the concepts as explicitly as possible. No prior knowledge of Python or statistics is assumed. These programs require the SciPy and Matplotlib modules. The tutorials are: - interactive_mean_std_normal_distribution.py - interactive_one_sample_t_test.py - interactive_two_sample_t_test.py - interactive_correlation_plot.py The same webpage also contains Matlab versions of the scripts. Please feel more than free to use any of the code for teaching, if you find it useful. Yours, Rajeev Raizada Research Assistant Professor Neukom Institute for Computational Science Dartmouth College HB 6255 Hanover NH 03755 Tel: 603 646 0175 E.mail: rajeev.raizada at dartmouth.edu WWW: http://www.dartmouth.edu/~raj From jjposner at optimum.net Fri Feb 18 18:16:53 2011 From: jjposner at optimum.net (John Posner) Date: Fri, 18 Feb 2011 12:16:53 -0500 Subject: [Edu-sig] Some interactive Python tutorials on basic stats, possibly useful for teaching In-Reply-To: References: Message-ID: <4D5EA985.4070504@optimum.net> Hi Rajeev, > The tutorials are: > - interactive_mean_std_normal_distribution.py > - interactive_one_sample_t_test.py > - interactive_two_sample_t_test.py > - interactive_correlation_plot.py Very nice! I taught introductory stat in night school at Boston University -- it was a "one chapter ahead of the students" kind of gig. This kind of tool would have extremely valuable for helping students to develop an intuition for statistical concepts. Working with the "correlation" program (Python 2.6, Win/XP SP3 box), I found that I needed to insert the statement pylab.draw() at the end of the clear_the_figure_and_empty_points_list() function. Again, many thanks! -John From rajeev.raizada at dartmouth.edu Fri Feb 18 19:09:37 2011 From: rajeev.raizada at dartmouth.edu (Rajeev Raizada) Date: Fri, 18 Feb 2011 13:09:37 -0500 Subject: [Edu-sig] Some interactive Python tutorials on basic stats, possibly useful for teaching In-Reply-To: <4D5EA985.4070504@optimum.net> References: <4D5EA985.4070504@optimum.net> Message-ID: On Fri, Feb 18, 2011 at 12:16 PM, John Posner wrote: > Very nice! I taught introductory stat in night school at Boston University > -- it was a "one chapter ahead of the students" kind of gig. This kind of > tool would have extremely valuable for helping students to develop an > intuition for statistical concepts. Great, many thanks for the positive feedback! By the way, I went to BU myself: Dept. of Cognitive & Neural Systems. > Working with the "correlation" program (Python 2.6, Win/XP SP3 box), > I found that I needed to insert the statement > ?pylab.draw() > at the end of the clear_the_figure_and_empty_points_list() function. Thank you, that's very useful to know. I will insert that line. I have only tested on Mac OS X. I have heard from a couple of Linux users that the figure-updating doesn't always work properly when using some Matplotlib backends. I wonder if inserting that pylab.draw() function will help to make the code work more consistently across different operating systems. Thanks again! Raj From kirby.urner at gmail.com Sat Feb 19 09:36:24 2011 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 19 Feb 2011 00:36:24 -0800 Subject: [Edu-sig] continued fractions (again) Message-ID: """ continued fractions >>> phi 1.6180371352785146 >>> pi 3.1415189855952756 """ phi =\ (1 + 1/ (1 + 1/ (1 + 1/ (1 + 1/ (1 + 1/ (1 + 1/ (1 + 1/ (1 + 1/ (1 + 1/ (1 + 1/ (1 + 1/ (1+ 1/ (1 + 1))))))))))))) pi =3 + \ (1**2/ (6 + 3**2/ (6 + 5**2/ (6 + 7**2/ (6 + 9**2/ (6 + 11**2/ (6 + 13**2/ (6 + 15**2/ (6 + 17**2/ (6 + 19**2/ (6 + 21**2/ (6 + 23**2/ (6 + 25**2/ (6+ 27**2/ 6)))))))))))))) def _test( ): import doctest doctest.testmod( ) if __name__ == "__main__": _test( ) From kirby.urner at gmail.com Mon Feb 21 01:49:26 2011 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 20 Feb 2011 16:49:26 -0800 Subject: [Edu-sig] discrete math vs digital math (does it matter?) Message-ID: Per the log entry below, I've been rubbing elbows with Portlandia's "intelligencia" again (comic book allusion), thanks to Chairman Steve (and Elizabeth). Steve is walking towards my place as I write this, having just met with the latter, the event organizer. Methinks "digital math" is gaining on "discrete math" as what to decry as not being taught (the ongoing media campaign I've been updating y'all about). The latter has the disadvantage of sounding like "discreet", whereas "digital" has these nice reverberations with "analog" -- and that's precisely the distinction "discrete" was trying to make in keeping it quantized, as in "not continuous". People already know "analog vs digital" from popular media. HDTV is digital. Shows like 'The X-Files' get recorded as files, on magnetized disks keeping ones and zeros, or in flash drives. Analog records still sound good though; worth keeping a turntable and watching video clips about how they work. However, the reason this is probably not an important argument is zip codes (e.g. 97214) are free to vary as to what they adopt (or don't) in terms of nomenclature. We might tell parents: "the Silicon Forest is amazed and agog at how plugged up the STEM pipeline has become, like why won't schools share more digital math?", whereas in a neighboring state we might say something about how the lack of "computational thinking" is quite stunning (and stunting). Why Johnny Can't Code is still a classic, though I don't know why the author bothered to take an ill-informed swipe at Python. Someone's partisan agenda I suppose **. http://radar.oreilly.com/2007/01/why-johnny-cant-program.html There's no need to standardize on "the one right way to talk" -- a sure way to get bogged down in nonsensical little arguments. OK, back to mathfuture. Oh yes, and the log entry: http://worldgame.blogspot.com/2011/02/open-secrets.html Steve will be joining you at Pycon soon. I'm too booked up this year. I forget if Michelle will be going, I think she said yes. Ah, Steve is here, Kirby Urner 4dsolutions.net Martian Math Digital Math Pythonic Math "Gnu" Math ** "The "scripting" languages that serve as entry-level tools for today's aspiring programmers -- like Perl and Python -- don't make this experience accessible to students in the same way. BASIC was close enough to the algorithm that you could actually follow the reasoning of the machine as it made choices and followed logical pathways. Repeating this point for emphasis: You could even do it all yourself, following along on paper, for a few iterations, verifying that the dot on the screen was moving by the sheer power of mathematics, alone. Wow!" ... sounds to me like this author doesn't have clear concepts, is getting this fed to him 2nd hand, not through personal experience. Since when is Python "entry level" (compared to what? -- every language has its newbies) and since when did we stop "following along on paper, for a few iterations"? OK, maybe not literal paper. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mpaul213 at gmail.com Mon Feb 21 18:44:55 2011 From: mpaul213 at gmail.com (michel paul) Date: Mon, 21 Feb 2011 09:44:55 -0800 Subject: [Edu-sig] discrete math vs digital math (does it matter?) In-Reply-To: References: Message-ID: Yes, I like that a lot - 'Digital' Math. It does have a different sense than 'Discrete' Math. However, down here in the trenches, I really don't expect that kind of distinction to be a part of math department discussions anytime soon. It will in fact come up for discussion in our department : ) , but it probably won't be taken seriously. As it stands, our curriculum presents AP Calc as the crown jewel of achievement. Everything points towards that goal. Along the way there are various acceptable exits for those who just need to graduate. 'Finite' Math / Prob Stat is one of those exits. It's basically 'Math for Dummies'. I really dislike that organization and would like to throw a monkey wrench into it. The good news is that this year I was given permission to create a Computational Analysis class, and I'm very happy with it. There are some amazing kids in there. I got a bunch of 3d puzzles in my room such as http://www.creativewhack.com/ , and there are some kids who take these things and create structures that just make me go 'Hmmm ... '. Truly remarkable. And there's one kid who is completely self-taught regarding Turing-completeness, the lambda calculus, and just about any programming language you name. He is way, way out there. I just kind of give him space to do whatever he needs. The cool thing is - he's not cocky about it. His attitude is so great. He just loves this stuff and is eager to share whatever he has found. So in the Computational Analysis class I am kind of bound to cover the Analysis curriculum, but I've been given permission to do it using computational approaches. One of the things I've noticed is that though our math courses are called 'Analysis', the texts all bear the title 'Precalculus'. I find that interesting, as there really is a difference between the terms. 'Precalc' tends to be an assortment of topics that one might need in calculus, but 'Analysis' historically arose after calculus in order to remove philosophical difficulties regarding continuity and infinity. So I've really focused on that as a theme - that here in the digital/information age the power of the discrete has proven itself, but the curriculum we study arose in an era that was concerned about continuity and the real numbers. I keep bringing up this continuous vs. discrete, or analog vs. digital, theme as something relevant to think about. During the first semester I focused mainly on programming in Python and using it for sequences, series, combinatorics, Boolean stuff, different base systems, and so on. I of course used the Litvins' Digital Agefor a lot of this. Second semester I plan to use Sage more as the primary tool and will get into trig and conics and other typical mathy things. I could easily see doing a lot of the first semester stuff in a course designated as 'Digital Math' that would not simply be a Finite Math dumping ground. That would be a such a great way to go. But ... one thing at a time. - Michel On Sun, Feb 20, 2011 at 4:49 PM, kirby urner wrote: > > Per the log entry below, I've been rubbing elbows > with Portlandia's "intelligencia" again (comic > book allusion), thanks to Chairman Steve (and > Elizabeth). > > Steve is walking towards my place as I write this, > having just met with the latter, the event organizer. > > Methinks "digital math" is gaining on "discrete > math" as what to decry as not being taught > (the ongoing media campaign I've been > updating y'all about). > > The latter has the disadvantage of sounding like > "discreet", whereas "digital" has these nice > reverberations with "analog" -- and that's precisely > the distinction "discrete" was trying to make > in keeping it quantized, as in "not continuous". > > People already know "analog vs digital" from > popular media. HDTV is digital. Shows like > 'The X-Files' get recorded as files, on magnetized > disks keeping ones and zeros, or in flash drives. > Analog records still sound good though; worth > keeping a turntable and watching video clips > about how they work. > > However, the reason this is probably not an > important argument is zip codes (e.g. 97214) > are free to vary as to what they adopt (or don't) > in terms of nomenclature. > > We might tell parents: "the Silicon Forest is > amazed and agog at how plugged up the > STEM pipeline has become, like why won't > schools share more digital math?", whereas in > a neighboring state we might say something > about how the lack of "computational thinking" > is quite stunning (and stunting). > > Why Johnny Can't Code is still a classic, though > I don't know why the author bothered to take an > ill-informed swipe at Python. Someone's partisan > agenda I suppose **. > > http://radar.oreilly.com/2007/01/why-johnny-cant-program.html > > There's no need to standardize on "the one right > way to talk" -- a sure way to get bogged down in > nonsensical little arguments. > > OK, back to mathfuture. > > Oh yes, and the log entry: > http://worldgame.blogspot.com/2011/02/open-secrets.html > > Steve will be joining you at Pycon soon. I'm > too booked up this year. I forget if Michelle will > be going, I think she said yes. > > Ah, Steve is here, > > Kirby Urner > 4dsolutions.net > > > Martian Math > Digital Math > Pythonic Math > "Gnu" Math > > ** > "The "scripting" languages that serve as entry-level > tools for today's aspiring programmers -- like Perl > and Python -- don't make this experience accessible > to students in the same way. BASIC was close enough > to the algorithm that you could actually follow the > reasoning of the machine as it made choices and > followed logical pathways. Repeating this point > for emphasis: You could even do it all yourself, > following along on paper, for a few iterations, > verifying that the dot on the screen was moving > by the sheer power of mathematics, alone. Wow!" > > ... sounds to me like this author doesn't have > clear concepts, is getting this fed to him 2nd hand, > not through personal experience. Since when is > Python "entry level" (compared to what? -- every > language has its newbies) and since when did we > stop "following along on paper, for a few iterations"? > OK, maybe not literal paper. > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -- "Computer science is the new mathematics." -- Dr. Christos Papadimitriou -------------- next part -------------- An HTML attachment was scrubbed... URL: From zmiller at gsc.edu Thu Feb 24 05:05:02 2011 From: zmiller at gsc.edu (Zac Miller) Date: Wed, 23 Feb 2011 23:05:02 -0500 Subject: [Edu-sig] UnitTest? Message-ID: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> Does anyone teach any unittest or test driven development to high school (or other) students? I'm looking for a quick reference or "cheat sheet" for python's unittest that I found around the internet once and never bookmarked. I may be imagining it but I remember it being great. If anyone knows the one that I think I saw one time or has a great one they wouldn't mind sharing I'd be very thankful! If not...perhaps it is my destiny to create one. -J. Zachary Miller From kb1pkl at aim.com Thu Feb 24 05:09:30 2011 From: kb1pkl at aim.com (Corey Richardson) Date: Wed, 23 Feb 2011 23:09:30 -0500 Subject: [Edu-sig] UnitTest? In-Reply-To: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> References: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> Message-ID: <4D65D9FA.50401@aim.com> On 02/23/2011 11:05 PM, Zac Miller wrote: > Does anyone teach any unittest or test driven development to high school (or other) students? I'm looking for a quick reference or "cheat sheet" for python's unittest that I found around the internet once and never bookmarked. I may be imagining it but I remember it being great. If anyone knows the one that I think I saw one time or has a great one they wouldn't mind sharing I'd be very thankful! If not...perhaps it is my destiny to create one. > I found https://portal.g-node.org/python-summerschool-2009/_media/cheat_sheets.pdf As a student, I wish we covered testing in class. It's a very useful skill! -- Corey Richardson From kirby.urner at gmail.com Thu Feb 24 08:18:25 2011 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 23 Feb 2011 23:18:25 -0800 Subject: [Edu-sig] UnitTest? In-Reply-To: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> References: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> Message-ID: I'm teaching it as a part of O'Reilly School of Technology's certificate program in Python 3. Steve Holden is the curriculum author. Thanks for asking this question. Corey's link looks useful, although Chrome is anxious about it having security problems. Kirby On Wed, Feb 23, 2011 at 8:05 PM, Zac Miller wrote: > Does anyone teach any unittest or test driven development to high school > (or other) students? I'm looking for a quick reference or "cheat sheet" for > python's unittest that I found around the internet once and never > bookmarked. I may be imagining it but I remember it being great. If anyone > knows the one that I think I saw one time or has a great one they wouldn't > mind sharing I'd be very thankful! If not...perhaps it is my destiny to > create one. > > -J. Zachary Miller > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zmiller at gsc.edu Thu Feb 24 15:34:30 2011 From: zmiller at gsc.edu (Zac Miller) Date: Thu, 24 Feb 2011 09:34:30 -0500 Subject: [Edu-sig] Thanks! Message-ID: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79DA@amp.gsc.edu> Thanks, that reference sheet is just the kind of thing I was looking for. I'm working through those Python courses at OST and Python 3 has a lot of great things in it! -J. Zachary Miller ________________________________________ From: edu-sig-bounces+zmiller=gsc.edu at python.org [edu-sig-bounces+zmiller=gsc.edu at python.org] On Behalf Of edu-sig-request at python.org [edu-sig-request at python.org] Sent: Thursday, February 24, 2011 6:00 AM To: edu-sig at python.org Subject: Edu-sig Digest, Vol 91, Issue 11 Send Edu-sig mailing list submissions to edu-sig at python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/edu-sig or, via email, send a message with subject or body 'help' to edu-sig-request at python.org You can reach the person managing the list at edu-sig-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Edu-sig digest..." Today's Topics: 1. UnitTest? (Zac Miller) 2. Re: UnitTest? (Corey Richardson) 3. Re: UnitTest? (kirby urner) ---------------------------------------------------------------------- Message: 1 Date: Wed, 23 Feb 2011 23:05:02 -0500 From: Zac Miller To: "edu-sig at python.org" Subject: [Edu-sig] UnitTest? Message-ID: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9 at amp.gsc.edu> Content-Type: text/plain; charset="iso-8859-1" Does anyone teach any unittest or test driven development to high school (or other) students? I'm looking for a quick reference or "cheat sheet" for python's unittest that I found around the internet once and never bookmarked. I may be imagining it but I remember it being great. If anyone knows the one that I think I saw one time or has a great one they wouldn't mind sharing I'd be very thankful! If not...perhaps it is my destiny to create one. -J. Zachary Miller ------------------------------ Message: 2 Date: Wed, 23 Feb 2011 23:09:30 -0500 From: Corey Richardson To: edu-sig at python.org Subject: Re: [Edu-sig] UnitTest? Message-ID: <4D65D9FA.50401 at aim.com> Content-Type: text/plain; charset=ISO-8859-1 On 02/23/2011 11:05 PM, Zac Miller wrote: > Does anyone teach any unittest or test driven development to high school (or other) students? I'm looking for a quick reference or "cheat sheet" for python's unittest that I found around the internet once and never bookmarked. I may be imagining it but I remember it being great. If anyone knows the one that I think I saw one time or has a great one they wouldn't mind sharing I'd be very thankful! If not...perhaps it is my destiny to create one. > I found https://portal.g-node.org/python-summerschool-2009/_media/cheat_sheets.pdf As a student, I wish we covered testing in class. It's a very useful skill! -- Corey Richardson ------------------------------ Message: 3 Date: Wed, 23 Feb 2011 23:18:25 -0800 From: kirby urner To: "edu-sig at python.org" Subject: Re: [Edu-sig] UnitTest? Message-ID: Content-Type: text/plain; charset="iso-8859-1" I'm teaching it as a part of O'Reilly School of Technology's certificate program in Python 3. Steve Holden is the curriculum author. Thanks for asking this question. Corey's link looks useful, although Chrome is anxious about it having security problems. Kirby On Wed, Feb 23, 2011 at 8:05 PM, Zac Miller wrote: > Does anyone teach any unittest or test driven development to high school > (or other) students? I'm looking for a quick reference or "cheat sheet" for > python's unittest that I found around the internet once and never > bookmarked. I may be imagining it but I remember it being great. If anyone > knows the one that I think I saw one time or has a great one they wouldn't > mind sharing I'd be very thankful! If not...perhaps it is my destiny to > create one. > > -J. Zachary Miller > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ _______________________________________________ Edu-sig mailing list Edu-sig at python.org http://mail.python.org/mailman/listinfo/edu-sig End of Edu-sig Digest, Vol 91, Issue 11 *************************************** From vernondcole at gmail.com Thu Feb 24 17:25:24 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 24 Feb 2011 09:25:24 -0700 Subject: [Edu-sig] UnitTest? Message-ID: I think for most high-school level work, use of the "assert" statement would be the first thing to teach. It can be used in an "if __name__ == '__main__': " construct in a module to make a good quick test. see https://launchpad.net/romanclass as an example. Simple modules do not need anything as complex as unittest. It would be a good advanced subject, though. -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From vceder at gmail.com Thu Feb 24 17:31:27 2011 From: vceder at gmail.com (Vern Ceder) Date: Thu, 24 Feb 2011 11:31:27 -0500 Subject: [Edu-sig] UnitTest? In-Reply-To: References: Message-ID: On Thu, Feb 24, 2011 at 11:25 AM, Vernon Cole wrote: > I think for most high-school level work, use of the "assert" statement would > be the first thing to teach. Doctests can also be good way to introduce the idea of testing. It's maybe a bit easier for beginners to grasp and a very natural Python technique. Vern > It can be used in an "if __name__ == '__main__': " construct in a module to > make a good quick test. > > see?https://launchpad.net/romanclass as an example. > > Simple modules do not need anything as complex as unittest. It would be a > good advanced subject, though. > -- > Vernon Cole > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -- Vern Ceder vceder at gmail.com, vceder at dogsinmotion.com The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW From kirby.urner at gmail.com Thu Feb 24 17:47:24 2011 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 24 Feb 2011 08:47:24 -0800 Subject: [Edu-sig] UnitTest? In-Reply-To: References: Message-ID: Yeah these are both good suggestions. It's fun to throw maybe one or two examples of unittest into the mix, maybe already written (so-called scaffolding). But unless it's a course about programming / development and nothing more, flogging unittest (aka PyUnit) might seem too much of a detour. In the OST course, there's some doctest towards the end of Python 1, with unittest the main opening topic of Python 2 (which also includes using MySQL as a back end and the Tk GUI was a front end). In a more purely math-oriented course, I still think of Sqlite as a great place to stash polyhedrons in relational tables. VPython is still my favorite library for geometry topics, though I'm still a big fan of POV-Ray after all these years. http://www.4dsolutions.net/ocn/numeracy0.html http://www.4dsolutions.net/ocn/pymath.html Kirby On Thu, Feb 24, 2011 at 8:31 AM, Vern Ceder wrote: > On Thu, Feb 24, 2011 at 11:25 AM, Vernon Cole > wrote: > > I think for most high-school level work, use of the "assert" statement > would > > be the first thing to teach. > > Doctests can also be good way to introduce the idea of testing. It's > maybe a bit easier for beginners to grasp and a very natural Python > technique. > > Vern > > > It can be used in an "if __name__ == '__main__': " construct in a module > to > > make a good quick test. > > > > see https://launchpad.net/romanclass as an example. > > > > Simple modules do not need anything as complex as unittest. It would be a > > good advanced subject, though. > > -- > > Vernon Cole > > > > > > _______________________________________________ > > Edu-sig mailing list > > Edu-sig at python.org > > http://mail.python.org/mailman/listinfo/edu-sig > > > > > > > > -- > Vern Ceder > vceder at gmail.com, vceder at dogsinmotion.com > The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lac at openend.se Thu Feb 24 21:07:26 2011 From: lac at openend.se (Laura Creighton) Date: Thu, 24 Feb 2011 21:07:26 +0100 Subject: [Edu-sig] UnitTest? In-Reply-To: Message from kirby urner of "Thu, 24 Feb 2011 08:47:24 PST." References: Message-ID: <201102242007.p1OK7QtT015543@theraft.openend.se> The children I have taught have had absolutely no problem with py.test. They wouldn't have had problems with nose, either. unittest is a bit wordy for them. And as far as I am concerned, unless you happen to need to test the formatting of your documentation, you shouldn't be using doctest at all. Laura From macquigg at ece.arizona.edu Sat Feb 26 18:28:58 2011 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Sat, 26 Feb 2011 10:28:58 -0700 Subject: [Edu-sig] UnitTest? In-Reply-To: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> References: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> Message-ID: <4D69385A.2050906@ece.arizona.edu> In my opinion, the unittest framework is way too cumbersome for an introductory course. Doctests are simple and self-explanatory. Students should get in the habit of writing a doctest for every function they write, even before the function itself is written. The main limitation of doctest is that it doesn't preserve values or maintain a set order when testing a bunch of functions. That can be fixed, however, by providing your own framework - a test function that calls the other functions in whatever order you want. The framework test is then just another doctest in the test function itself. This is a simple extension of what the students already know. -- ************************************************************ * * David MacQuigg, PhD email: macquigg at ece.arizona.edu * * * Research Associate phone: USA 520-721-4583 * * * * ECE Department, University of Arizona * * * * 9320 East Mikelyn Lane * * * * http://purl.net/macquigg Tucson, Arizona 85710 * ************************************************************ * On 2/23/11 9:05 PM, Zac Miller wrote: > Does anyone teach any unittest or test driven development to high school (or other) students? I'm looking for a quick reference or "cheat sheet" for python's unittest that I found around the internet once and never bookmarked. I may be imagining it but I remember it being great. If anyone knows the one that I think I saw one time or has a great one they wouldn't mind sharing I'd be very thankful! If not...perhaps it is my destiny to create one. > > -J. Zachary Miller From lac at openend.se Sat Feb 26 19:25:20 2011 From: lac at openend.se (Laura Creighton) Date: Sat, 26 Feb 2011 19:25:20 +0100 Subject: [Edu-sig] UnitTest? In-Reply-To: Message from David MacQuigg of "Sat, 26 Feb 2011 10:28:58 MST." <4D69385A.2050906@ece.arizona.edu> References: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> <4D69385A.2050906@ece.arizona.edu> Message-ID: <201102261825.p1QIPKNu005905@theraft.openend.se> In a message of Sat, 26 Feb 2011 10:28:58 MST, David MacQuigg writes: >In my opinion, the unittest framework is way too cumbersome for an >introductory course. Doctests are simple and self-explanatory. >Students should get in the habit of writing a doctest for every function >they write, even before the function itself is written. I think this is a reason to use py.test or nose rather than unittest, but not a reason to use doctest. I'm very fond of Mark Pilgrim's Unit testing chapter in Dive into Python http://diveintopython.org/unit_testing/index.html (2.x) http://diveintopython3.org/unit-testing.html (3.x) which is easy to adapt to a less verbose testing framework. Laura From calcpage at aol.com Sun Feb 27 22:56:30 2011 From: calcpage at aol.com (A. Jorge Garcia) Date: Sun, 27 Feb 2011 16:56:30 -0500 Subject: [Edu-sig] discrete math vs digital math (does it matter?) In-Reply-To: References: Message-ID: <8CDA4E052FB1843-EE8-1F1B5@Webmail-m113.sysops.aol.com> >> During the first semester I focused mainly on programming in Python and using it for sequences, series, >> combinatorics, Boolean stuff, different base systems, and so on. I of course used the Litvins' Digital Age >> for a lot of this. Second semester I plan to use Sage more as the primary tool and will get into trig and >> conics and other typical mathy things. Hey Michel, its good to know that I'm not the only one down here in the trenches trying to do some Discrete Math in HS using a computational approach! I have these kids for 2 semesters. The first semester is called Computer Math which, believe it or not, is a course I introduced in the 80s using IBM BASICA that covered similar material as you did with the Litvin text. I used the Litvin text in Computer Math with SAGE all that first semester this year. However, my crew was not as adept as yours sounds! So, we only covered the first 6 chapters. Now, I have the cream of 2 sections of Computer Math in the second semester (we call it Advanced Computer Math). I will start to jump around a bit to cover some of the more interesting topics in the time remaining. The kids love using SAGE too. Funny you should be using preCalc texts in your class as well. The texts titled "Analysis" probably are preCalc texts too. In HS "Analysis" is usually short for "Analysis of Functions" or "Functional Analysis" which is really the meat of preCalc. I don't think the authors of those books were talking about Real Analysis. Also, we just finished a unit of conics in my preCalc class. We did everything the traditional way as well as using Graphing Calculators. Then, when I went over a quiz they just took, I thought I'd show them how its done in SAGE. These students almost fell out of their chairs! HTH, A. Jorge Garcia Applied Math and CompSci http://shadowfaxrant.blogspot.com http://www.youtube.com/calcpage2009 From macquigg at ece.arizona.edu Mon Feb 28 02:37:10 2011 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Sun, 27 Feb 2011 18:37:10 -0700 Subject: [Edu-sig] UnitTest? In-Reply-To: <201102261825.p1QIPKNu005905@theraft.openend.se> References: <1DECD34B57C2C44A8F3374D034E6735A03133C6F79D9@amp.gsc.edu> <4D69385A.2050906@ece.arizona.edu> <201102261825.p1QIPKNu005905@theraft.openend.se> Message-ID: <4D6AFC46.7060106@ece.arizona.edu> As usual, Pilgrim does an excellent job of explaining his topic. I haven't looked at unittest for years, but Chapter 9 in his new book explains it well. That said, I still prefer doctest over unittest. 1) doctests can be introduced on day one, without much explanation. Pilgrim waits until Chapter 9 to introduce the unittest module, and then the presentation depends on students already knowing how to define classes. At that point, it is much harder to get students to change their habits, and start writing tests for even the simplest functions. Even worse, students who stop short of learning OOP, and that includes most who are not intending to be programmers, those students will never appreciate the value of including tests as an integral part of writing a program. 2) doctests look just like what students will enter in an interactive session, while testing some function they have just written. Cut-and-paste a successful test from the interpreter to the editor window, and you are done. 3) doctests serve two functions - documentation and testing. Start with a simple well-written doctest to make the purpose of a function crystal clear. Then add numerous unit tests, one at a time as you think of them, placing them in a separate test function to a avoid a conflict between clarity and completeness. Refine your doctests to make the explanation even more clear, but don't throw away your old doctests. Just move them to the unit test function. 4) The explanatory doctests are what motivate students to write any tests at all. Without this, writing tests gets put off to the end, or never done. Google [python doctest] for lots of interesting discussion. Two very helpful links: http://blog.tplus1.com/index.php/2008/07/14/python-doctests-seem-underappreciated/ http://stackoverflow.com/questions/361675/python-doctest-vs-unittest See pykata.org for examples that make extensive use of doctests for both explanation and unit testing. On 2/26/11 11:25 AM, Laura Creighton wrote: > In a message of Sat, 26 Feb 2011 10:28:58 MST, David MacQuigg writes: >> In my opinion, the unittest framework is way too cumbersome for an >> introductory course. Doctests are simple and self-explanatory. >> Students should get in the habit of writing a doctest for every function >> they write, even before the function itself is written. > I think this is a reason to use py.test or nose rather than unittest, > but not a reason to use doctest. I'm very fond of Mark Pilgrim's Unit > testing chapter in Dive into Python > http://diveintopython.org/unit_testing/index.html (2.x) > http://diveintopython3.org/unit-testing.html (3.x) > > which is easy to adapt to a less verbose testing framework. > > Laura > > > -- ************************************************************ * * David MacQuigg, PhD email: macquigg at ece.arizona.edu * * * Research Associate phone: USA 520-721-4583 * * * * ECE Department, University of Arizona * * * * 9320 East Mikelyn Lane * * * *http://purl.net/macquigg Tucson, Arizona 85710 * ************************************************************ *