[Edu-sig] CS teaching approaches

kirby urner kirby.urner at gmail.com
Sun Dec 20 17:19:17 CET 2009


On Sun, Dec 20, 2009 at 7:23 AM, Daniel Ajoy <da.ajoy at gmail.com> wrote:

> On Sun, 20 Dec 2009 06:00:01 -0500, <edu-sig-request at python.org> wrote:
>
> > hello,
> > i will start introductory CS courses for middle school students (age 10
> -13);
> > i will mainly make use of logo-like languages and approaches, Turtle
> > Art among a couple of others;
> > i'd like to ask if you know which the most widespread approaches to CS
> > teaching are today for young students, or if someone has collected on
> > the web a simple classification among different approaches, showing
> > similarities and differences;
> > i'd like to let students taste something new and then report back to
> > you the result of the courses
>
>
> In my country some teachers still go through
>
> Flowcharts
> pseudocode
> then actual programming: using visualfox, pascal, or visual basic
>

Wow, visualfox.

That's another language I've used plenty.

Wish I could find another gig for that here in Portland -- maybe I will.

Is visualfox still used commercially a lot?  I hear it's big in Prague --
but that was some years ago.

Back to Python, I've been helping this polytech student in Indonesia with
his Monte Carlo integration.  There's a simple Mathematica implementation
I'm following, but I think my error term calc is screwed up.

If anyone here has the time to give me some pointers...  help me spread
Python user base in Indonesia!

CS teachers probably do this in their sleep, or for breakfast [some other
idiom].  This could be another area where our DM track (digital math track)
segues to calculus (always looking for those segues).

http://math.fullerton.edu/mathews/n2003/MonteCarloMod.html

from random import randint
import math

def getpoints(n, a, b):
    interval = b-a   # assume a <= b
    points = []  # empty list
    for i in range(n):
        r = randint(0,100)  # some percent
        point = a + (interval * .01 * r)  # a plus some percent of interval
        points.append(point)
    return points

def g(x):
    """ the function to evaluate for its definite integral over an interval
"""
    # return x * x  # or x ** 2
    return math.sqrt(x)

def average(f, somepoints):
    n = len(somepoints)  # how many points
    thesum = sum( [f(x) for x in somepoints])
    return thesum/n

def geterror(f, guess, somepoints, a, b, n):
    """ I have some questions about this """
    thesum = (1.0/n) * sum( [f(x) * f(x) for x in somepoints])  # right?
    return (b-a) * math.sqrt(abs(thesum - guess*guess) / n)

def montecarlo(f, n, a, b):
    thepoints = getpoints(n, a, b)
    theaverage = average(f, thepoints)
    approx = (b - a) * theaverage
    error = geterror(f, approx, thepoints, a,b, n)
    return (approx, error)

def tests():
    print getpoints(10, 1, 4)
    print getpoints(10, 0, 10)
    print average(g, getpoints(10, 0, 4))
    print montecarlo(g, 100, 0, 4)

if __name__ == "__main__":
    tests()



Kirby

-- 
>>> from mars import math
http://www.wikieducator.org/Digital_Math
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20091220/00b50f61/attachment.htm>


More information about the Edu-sig mailing list