[Edu-sig] Re: good programing env features?

2021-02-18 Thread André Roberge
On Thu, Feb 18, 2021 at 10:19 AM Jurgis Pralgauskis <
jurgis.pralgaus...@gmail.com> wrote:

> Hi,
>
> it not directly Py oriented -- but I think you have some hints :)
>
> We are trying to choose among programming envs for 5th graders:
> Scratch
> https://pencilcode.net
> https://edublocks.org
> MicroBit blocks
> Logo
> CodeMonkey
>
> and the discussions are a bit chaotic based on each ones experience...
> Maybe you know like 5 good aspects/categories to evaluate by?
>
> kind of like here, but may be more abstract
> https://github.com/aroberge/reeborg-howto/blob/master/src/checklist.md
>
>
How can you ask about improving on the above checklist?  ;-) ;-)

I have suggestions for only two criteria:

* Availability of online documentation in a language that can be understood
by the students, so that interested students can explore beyond what is
shown in the classroom.
* Think of the extreme **stereotypical** boy and girl: can the programming
environment (and chosen activities!) cater to both of these extremes.

Please, share back what your group decides upon!

André


> --
> Jurgis Pralgauskis
> tel: 8-616 77613;
> Don't worry, be happy and make things better ;)
>

Trying! ;-)


> https://galvosukykla.wordpress.com/
> ___
> Edu-sig mailing list -- edu-sig@python.org
> To unsubscribe send an email to edu-sig-le...@python.org
> https://mail.python.org/mailman3/lists/edu-sig.python.org/
> Member address: andre.robe...@gmail.com
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/
Member address: arch...@mail-archive.com


[Edu-sig] Re: Friendly-traceback: useful tool for those teaching Python

2021-02-02 Thread André Roberge
On Tue, Feb 2, 2021 at 2:37 PM kirby urner  wrote:

> On Tue, Feb 2, 2021 at 5:48 AM André Roberge 
> wrote:
>
>> Hello everyone,
>>
>> For about 20 months now, I have been working on a Python package intended
>> to help beginners figure out what went wrong when their program generates a
>> traceback. This package is called Friendly-traceback; you can find the
>> fairly extensive documentation at
>> https://aroberge.github.io/friendly-traceback-docs/docs/html/
>>
>>
> Hi André --
>
> I'm reading your docs now.
>
> When I start into Python with beginners, I'll typically start with:
>
> >>> dir( )  # how will HyperKitty mangle this?
>
> showing what's in the namespace, the names Python
> knows when "in" the namespace.
>
> But then the question right away arises:  where are
> print, hex, str, dict... all these names Python knows?
>
> Answer (as we all know):  __builtins__
>
> So then I do a dir(__builtins__)
>

I think you mean simply  __builtins__, without the dir().  I use "pretty"
from Rich (
https://rich.readthedocs.io/en/latest/introduction.html?highlight=pretty#python-in-the-repl)
so that dicts are nicely formatted.




>
> [ pray to HyperKitty for no mangling ] and they see:
>
> Wow! Lots and Lots of names (so that's where
> everyone has been hiding), many with Error
> and/or Warning in them.  Those come at the top
> as dir returns string elements alphabetically and
> capitalized Exceptions list up top (or leftmost).
>
> This will be my bridge to your Friendly-Traceback
> utility i.e. here would be an (early, introductory)
> example of a 3rd party project aimed at helping
> a beginner get the most out of the Python experience.
>
> Tracebacks themselves have that purpose already,
> and you're enhancing that existing capability, which is
> easy for beginners to understand. Make a good thing
> better.
>
> A current weakness in my curriculum is I don't spend
> enough time on IDE features relating to debugging and
> live inspecting of what's in the namespace.  I demonstrate
> a lot using Spyder, assuring them a different IDE is just
> fine.  Spyder has features that make it great for screen
> sharing Python, such as scrollback, the %magics, embedded
> plots...
>
> Anyway, my point is Exceptions and the Tracebacks they
> occasion, deserve a direct and early discussion, as any
> beginner is likely to stumble across both in the course of
> ordinary REPL use.
>
> I'm still adding pages to my most recent iteration of an Elite
> School (and I do have synchronous students -- we meet once a
> week).  We'll be discussing your innovative enhancements.
> Ideally, at least one of us (most likely me) will install it and
> do Show & Tell (a Lightning Talk).
>
> Back to reading the docs...
>
> Kirby
>
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/
Member address: arch...@mail-archive.com


[Edu-sig] Friendly-traceback: useful tool for those teaching Python

2021-02-02 Thread André Roberge
Hello everyone,

For about 20 months now, I have been working on a Python package intended
to help beginners figure out what went wrong when their program generates a
traceback. This package is called Friendly-traceback; you can find the
fairly extensive documentation at
https://aroberge.github.io/friendly-traceback-docs/docs/html/

Friendly-traceback can be used to run programs from the command line, or
from an editor; it also comes with its own REPL. Jupyter notebooks are also
supported.

While there is still much to be added to it (I don't know if I'll ever
reach a "complete enough" version to be designated as version 1.0), I would
appreciate feedback from those of you who teach beginners (or advanced
beginners), including any suggestion as to how it could be made more useful.

All the best and stay safe,

André Roberge
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/
Member address: arch...@mail-archive.com


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-09 Thread André Roberge
On Thu, Apr 9, 2020 at 2:02 PM kirby urner  wrote:

> Here's a thread I'm starting with my campers taking a PyCamp course.
>
> Yesterday we were co-evolving a calculator driven by looping menu.  It
> does squares and square roots (one of the campers supplied this logic) and
> I was just getting around to introducing the y^x key as some call it, i.e.
> any number to any power, Python's pow(num, exp).
>
> Today we'll pick up where we left off.
>
> We used the shared whiteboard to draw radical signs as I intoned about how
> pow(3, 3) means like ```3 * 3 * 3```.  Math Adventures in Python.  We might
> also say ```3 ** 3``` (and not ```3^3``` like in so many languages).
> sqrt(num) is the same as ```num ** (1/2)``` and we can get the 3rd root of
> 27 with ```27 ** (1/3)```.
>
> [ Sorry for all the markdown by the way, if you're getting a plaintext
> version -- an option I'd advocate for browser based viewers of the archives
> someday (to see what it looked like way back when, Before Markdown). ]
>
> So here's what we're up against:  say I want to raise 10 to the 1/3rd
> power, same as taking a "cube root" of 10 (tetrahedral whatever).  The menu
> prompts:
>
> ```python
>
> num = float(input("Your number please: > "))  # yes a bit dangerous
> exp = float(input("...and your exponent: > "))  #  user wants to do 1/3
> ```
>
> Of course that last statement raises an exception because float("1/3")
> doesn't work (isn't supposed to). What shall we do then?
>


Try the following:

from fractions import Fraction
float(Fraction("1/3"))

Knowing you, I'm sure you can figure out plenty of useful applications of
this. :-)

André



>
> I'm thinking we parse anything that looks like a legal fraction and do the
> floating point conversion from int(p)/int(q).  We won't allow input like
> 2.1/3.6 just int/int.  I've already preached against eval() but if it
> passes my regular expression test first...
>
> Anyway, it's a discussion.  These are like middle schoolers previewing
> high school, at a time when kid focused code schools were under some
> pressure to convert to "everything online".  I used to drive to the schools.
>
> We don't have to use a regexp!  A good excuse to say what these are
> though.  Or test for the pattern but then use split("/") to pry numerator
> from denominator, once we know that'll work?
>
> https://github.com/4dsolutions/python_camp/blob/master/camper_program.py
> (snapshot -- part of the camp is they watch me git pushing updates to the
> camp repo).
>
> Rather perversely, I may set things back between camps i.e. I'll
> deliberately revert the code.
>
> Comments?  Code?
>
> Kirby
>
> PS:  I notice Python 3.8 is being rather more generous in its statistics
> module. Campers who wander from the base camp fire are likely to find
> themselves staring at pdfs and cdfs.
> ___
> Edu-sig mailing list -- edu-sig@python.org
> To unsubscribe send an email to edu-sig-le...@python.org
> https://mail.python.org/mailman3/lists/edu-sig.python.org/
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


Re: [Edu-sig] Design Patterns

2005-08-25 Thread André Roberge
Disclaimer: I haven't followed this thread as closely as I should.

Picking up on a few words from the discussion
(namely triangle and properties).

When I think of a real life triangle, I can describe it
in terms of various properties, such as: the length of
each of its three sides, its area, the three internal
angles, its perimeter, etc.  Of course, most of these
properties are interdependent.

If I want to refer to a triangle property using the
dot notation, I want to write:
triangle.area
triangle.perimeter
triangle.shortest_side
triangle.longest_side
etc.

Now, imaging taking a program similar to Paint
and drawing a triangle.
Then change it somewhat (by flipping it, lengthening one
side, etc). [Unlike paint, our program keeps track of
objects' nodes.]

Suppose I am lengthening one side from 100 horizontal pixels to 120
horizontal pixels (looking at the status bar where such information
is displayed).
When I change one value, others may change too.
When I change one value, I am first and foremost
interested about that particular value ... I don't
want to have to think of what other values
(properties) may need to change.

--- Now, back to computer programming

Python properties make it possible to think of all of an
object's attribute on an equal footing (given an appropriate
design for the class to which the object belong).  Without
properties, I have to distinguish between values that
can be assigned directly and those that must be computed.
Of course, a lot of work has to be done behind the scene
to keep things consistent.

Java's recommended way would be to use a set method
for assignment and a get method for retrieval
(with the same required work done behind the scene).

I find Python's properties much more elegant (and simpler
for the end user) than having a whole bunch of get_this()
set_that() to use.

André

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] software skills course

2005-08-17 Thread André Roberge
Kirby Urner wrote:
 Howdy André --
 
 I just sent the following email to pydotorg in hopes of getting back in the
 harness re the edu-sig page at the site.  As you see, my primary motivation
 is to get RUR-PLE linked, for other educators to find.
 
 My apologies for being neglectful on this score up to now.
 
 Kirby
 

Thanks! :-)
André

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] software skills course

2005-08-16 Thread André Roberge
Greg Wilson wrote:
 Hi,
 
 I'm working with support from the Python Software Foundation to develop
 an open source course on basic software development skills for people
 with backgrounds in science and engineering.  I have a beta version of
 the course notes ready for review, and would like to pull in people
 in scieng to look it over and give me feedback.  If you know anyone
 who fits this bill (particularly people who might be interested in
 following along with a trial run of the course this fall), I'd be
 grateful for pointers.
 
 Thanks,
 Greg Wilson
I would be interested in being a reviewer; I might even be fool enough 
to volunteer to translating the course in French!

André Roberge

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] ANN: new version of RUR-PLE

2005-05-18 Thread André Roberge
Version 0.8.6a is now available.

This version is mostly a bug fixed version.
* unicode problem corrected (bug introduced in version 0.8.5)
* linenumber information on syntax errors corrected
* removed the URL browser capability
* corrected typo and change explation of next_to_a_beeper() in lessons
* corrected name of robot in one lesson

Addition:
tower of Hanoi solution(.rur file) (with two typical .wld files)
8 queen puzzle solution (.rur file)

Additional changes expected in version 0.8.6b

André

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Python for CS101

2005-05-04 Thread André Roberge
[EMAIL PROTECTED] wrote:
Also, down the road, I can see a CS curriculum which is pretty .NET centric,
 
 
 To me, the spirit of Python and .Net are quite unaligned.
 
[Snip...]
 

 It is also no small thing to me to feel inhibited 
 from mentioning Ted's entry and hoping to stimulate some
 discussion of it here - though finding no direct mention of Python in
 it.
 
 Art

As I suspect I am the person responsible for Art mentioning his feeling 
of being inhibited in discussing Ted Leung's blog entry on this list,
I can't help but feel compelled to state that the comments I made were 
not meant to inhibit any discussion.  I just voiced (perhaps too 
forcefully) my personal opinion.

Peace,

André

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Python for CS101

2005-05-03 Thread André Roberge
Of course, I believe that Python is the ideal language for CS101. 
Otherwise, I would probably not be so interested in this list ;-)

Here are some arguments that I have not seen (except for the first one) 
in the current thread.

1. Python is often described as executable pseudocode.

2. Python comes with batteries included.  That is to say, there are 
python modules (libraries) to help you do pretty much everything you 
might need in all areas: text processing, graphics, etc.

1. + 2.  Python can be used in (almost) all subsequent CS courses in 
going from pseudo-code on the blackboard (if still using blackboards) to 
python program on a computer (with a projector in class) and working 
code demonstrating the algorithm studied.

3. Learning C after learning Python can be done via Pyrex.
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
 From the Web site: Pyrex is Python with C data types.

4. Learning Java after learning Python can be done via Jython.
http://www.jython.org/
 From the Web site:
Jython is an implementation of the high-level, dynamic, object-oriented 
language Python seamlessly integrated with the Java platform.

5. Learning Perl after Python can ... never mind. ;-)

André

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] GvR question

2005-05-03 Thread André Roberge
Dan Schellenberg wrote:
[snip]
 
 On lesson 17 http://gvr.sourceforge.net/lessons/rfrank/step17/  I have 
 been unable to contrive a solution that I think my students would 
 understand at this stage.  The problem is very straightforward, but the 
 difficulty comes in assigning a proper while loop to the code block that 
 defines how long Guido continues to pick up garbage (ie. none of the 
 built in conditionals provide a good boolean for this problem, though 
 right_is_clear is workable, just not eloquent).  I have solved the 
 problem using the aforementioned right_is_clear conditional in the while 
 loop (see first example below), and have also solved it (much more 
 eloquently in my opinion) using recursion.  However, I would like to 
 have a more eloquent solution without having to use recursion, as I am 
 not sure that I want to introduce that concept at this stage.  Below are 
 my two solutions.  Anyone have an idea on how to improve the readability 
 of these solutions for the students?

Here's my non-recursive solution in rur-ple, which could be easily 
translated in GvR.  Actually, I tried to keep your structure intact as 
much as possible.  It does not use the right_is_clear conditional.


# definitions

def turn_right():
 repeat(turn_left, 3)

def turn_around():
 turn_left()
 turn_left()

def facing_south():   # not built-in yet in rur-ple;
   # hence need to use return
 turn_around()
 answer = facing_North()
 turn_around()
 return answer

def go_south_west_corner():
 while not facing_south():
 turn_left()
 while front_is_clear():
 move()
 turn_right()
 while front_is_clear():
 move()
 turn_right()  # thus facing north

def go_north_east_corner():
 while not facing_North():
 turn_left()
 while front_is_clear():
 move()
 turn_right()
 while front_is_clear():
 move()

# the following definition is modified from yours

def pickup_column_and_come_back(): # normally facing north
 while front_is_clear():
 while next_to_a_beeper():
 pick_beeper()
 move()
 turn_around()  # now facing south
 while front_is_clear():
 move()
 turn_left()# now facing east, perhaps ending
 if front_is_clear():
 move()
 turn_left()# ends next column, face North

# end of definitions
# =
# begin algorithm per se

go_south_west_corner()

while facing_North():
 pickup_column_and_come_back()
 # note: when reaching east wall, will not face north

# exits at south-east corner, facing east

turn_left()
while front_is_clear():
 move()

while carries_beepers():
 put_beeper()

go_south_west_corner()
turn_off()
---

André

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] GvR question (correction)

2005-05-03 Thread André Roberge
André Roberge wrote:
 Dan Schellenberg wrote:
 [snip]
 
On lesson 17 http://gvr.sourceforge.net/lessons/rfrank/step17/  I have 
been unable to contrive a solution that I think my students would 
understand at this stage.  The problem is very straightforward, but the 
difficulty comes in assigning a proper while loop to the code block that 
defines how long Guido continues to pick up garbage (ie. none of the 
built in conditionals provide a good boolean for this problem, though 
right_is_clear is workable, just not eloquent).  I have solved the 
problem using the aforementioned right_is_clear conditional in the while 
loop (see first example below), and have also solved it (much more 
eloquently in my opinion) using recursion.  However, I would like to 
have a more eloquent solution without having to use recursion, as I am 
not sure that I want to introduce that concept at this stage.  Below are 
my two solutions.  Anyone have an idea on how to improve the readability 
of these solutions for the students?
 
 
 Here's my non-recursive solution in rur-ple, which could be easily 
 translated in GvR.  Actually, I tried to keep your structure intact as 
 much as possible.  It does not use the right_is_clear conditional.

Oops... misses garbage along the top (north) wall. My test case world 
did not have garbage there.
Required modifications noted below ... as well as some moving
parts of the code from the definition section to
the execution section - it might be easier to understand
this way.


 
 # definitions
 
 def turn_right():
  repeat(turn_left, 3)
 
 def turn_around():
  turn_left()
  turn_left()
 
 def facing_south():   # not built-in yet in rur-ple;
# hence need to use return
  turn_around()
  answer = facing_North()
  turn_around()
  return answer
 
 def go_south_west_corner():
  while not facing_south():
  turn_left()
  while front_is_clear():
  move()
  turn_right()
  while front_is_clear():
  move()
  turn_right()  # thus facing north
 
 def go_north_east_corner():
  while not facing_North():
  turn_left()
  while front_is_clear():
  move()
  turn_right()
  while front_is_clear():
  move()
 
 # the following definition is modified from yours
 
 def pickup_column_and_come_back(): # normally facing north
  while front_is_clear():
  while next_to_a_beeper():
  pick_beeper()
  move()

while next_to_a_beeper():   # forgot garbage there
pick_beeper()

  turn_around()  # now facing south
  while front_is_clear():
  move()

## remove end of this definition; put in section below

 
 # end of definitions
 # =
 # begin algorithm per se
 
 go_south_west_corner()
 
 while facing_North():
  pickup_column_and_come_back()   # face south after
turn_left()   # now facing east; may end that way
if front_is_clear():
move()
turn_left()   # ends next column, face North

 
 # exits at south-east corner, facing east
 
 turn_left()
 while front_is_clear():
  move()
 
 while carries_beepers():
  put_beeper()
 
 go_south_west_corner()
 turn_off()
 ---
 
 André

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Re: Idle play

2005-04-29 Thread André Roberge
Kirby Urner wrote:
[snip...]
Adding n consecutive layers of this Christmas Tree gives n**3.
The first thing that came to my mind is Pascal's triangle; adding the 
number on the n_th line gives 2^n.


We looked up Tetra here:
http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?An
um=A000292
Great link!  I especially like, given my previous observation, the 
following:

=
   Consider the square array
   1 2 3 4 5 6...
   2 4 6 8 10 12...
   3 6 9 12 16 20...
   4 8 12 16 20 24...
   5 10 15 20 25 30...
   ...
   then a(n) = sum of n-th antidiagonal. - Amarnath Murthy
  (amarnath_murthy(AT)yahoo.com), Apr 06 2003
=
I was thinking a few days ago of writing a *recursive* function to 
create Pascal's triangle ... as an alternative example to the 
traditional Fibonacci's numbers.   I suspect (and will have to spend 
some time reading!) that the link you gave may provide a lot of 
potential examples of recursive functions.  I always found that, using
only fib(n) as an example of recursion was not very inspiring.

André
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Re: Idle play

2005-04-29 Thread André Roberge
Kirby Urner wrote:
[snip]
Another way David talked about, to get cubes:
n**3 = 6 * Tetra + n where Tetra is a tetrahedral number 0,1,4,10,20,35...
We looked up Tetra here:
http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?An
um=A000292
Another relevant page (with a picture) from the same site is:
http://www.research.att.com/~njas/sequences/demo3.html
(Darn, I'm breaking my own rule: no reference to python in this message ;-)
André
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Computing derivative

2005-04-08 Thread André Roberge
For that were interested in the discussion about computing derivatives 
numerically using Python, I have posted a short description *including 
pictures* at http://aroberge.blogspot.com/.

Enjoy!
André
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Re: More on intro to Python (today's 3 hr training)

2005-03-29 Thread André Roberge
Kirby Urner wrote:
[snip]

def derivative(f):

Factory function:  accepts a function, returns a closure

def df(x, h=1e-8):
return (f(x + h) - f(x))/h
return df

Sorry for being picky, but while your derivative factory
function follows the mathematical definition, it is not the
best way to do it numerically.  The preferred way is:
 def derivative(f):
 
 Factory function:  accepts a function, returns a closure
 
 def df(x, h=1e-8):
 return (f(x + h/2) - f(x - h/2))/h
 return df
This is best seen by doing a graph (say a parabola) and drawing
the derivative with a large h using both methods near a local
minimum.
André
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Re: Integration correction

2005-03-29 Thread André Roberge
Kirby Urner wrote:
From: Kirby Urner [EMAIL PROTECTED]
[snip   ... Kirby, Art and many others including myself discuss
 the possible misuse of decorators in the context of calculating
 derivatives and integrals numerically  end snip]
Now, if g(x) really *did* go on for 30-40 lines, OK, then maybe a decorator
adds to readability.
Something to think about.
Kirby
Well, I don't think that decorators would add to readability once you've 
defined your functions.  I've played around with using decorators (and 
not) for a while, and here's what I would like to submit to this list
as a possible summary.  This non-decorator approach is very clean imho.

def derivative(f):

Computes the numerical derivative of a function.
Intended to be used as a decorator.

def df(x, h=0.1e-5):
return ( f(x+h/2) - f(x-h/2) )/h
return df
def simpson_integral(f, a, b, n=1000):

Computes the numerical integral of a function
using the extended Simpson's rule.  This gives exact results
for polynomials of O(3).

h = float(b-a)/n
sum1 = sum(f(a+k*h) for k in range(1, n, 2))
sum2 = sum(f(a+k*h) for k in range(2, n, 2))
return (h/3)*( f(a)+f(b) + 4*sum1 + 2*sum2 )
# test functions
def g2(x): return x*x
def g3(x): return x*x*x
# first derivatives
dg2 = derivative(g2)
dg3 = derivative(g3)
# second derivatives
d2g2 = derivative(derivative(g2))
d2g3 = derivative(derivative(g3))
# integrals
intg2 = simpson_integral(g2, 0, 1)
intg3 = simpson_integral(g3, 0, 1)
print ' functions: ', g2(2.), g3(2.)
print ' first derivatives: ', dg2(2.), dg3(2.)
print 'second derivatives: ', d2g2(2.), d2g3(2.)
print 'numerical integral: ', intg2, intg3
# functions:  4.0 8.0
# first derivatives:  4.012 12.08
#second derivatives:  2.00017780116 12.001066807
#numerical integral:  0. 0.25

#== WARNING ==
#-- derivatives computed numerically do not
#-- necessarily converge for small h --
h = .1
for i in range(1, 7):
h /= 100
print h, 'first = ', dg2(2, h), 'second =', dg3(2, h)
#0.001 first =  4.0 second = 12.0025
#1e-005 first =  3.989 second = 11.97
#1e-007 first =  4.234 second = 12.000159
#1e-009 first =  4.0033096 second = 12.009929
#1e-011 first =  4.0033096 second = 12.009929
#1e-013 first =  4.00568467285 second = 12.0170540185
#
André
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Re: More on intro to Python (today's 3 hr training)

2005-03-29 Thread André Roberge
Kirby Urner wrote:
[snip - deleted stuff about numerical integration]
So my general question is, as usual:  wouldn't this be an interesting and
intelligent way to teach math?  You get concepts, and you get programming
skills, and you start to think about analyzing and fine tuning algorithms.
Plus you grow to appreciate the power of the calculus, which gives us close
formed expressions so often -- a way to avoid fast for-loops entirely.
Kirby
I think it would be ... were it not for the following facts:
1) subjects are taught in a compartimentalised way, leading to easy 
testing/grading ...

you don't teach introductory numerical analysis
at the same time as
you teach introductory computer programming
at the same time as
you teach introductory calculus
at the same time as 
(exception: many learn most of the useful math stuff in their physics 
class first, at least in North America.)

2) A mathematical limit is not the same as a small but finite numerical 
precision.  Mathematicians would probably cringe at the thought of 
teaching about using these two side-by-side in the same course.

Of course, if one has the freedom to be able to cover many unrelated 
topics to the same group of students, one can get away with it. 
However, I don't know of many places in North American Universities when 
you can do such a thing  (One exception might be the University of 
British Columbia where they introduced a general 1st year science course 
covering biology/math/physics/chemistry.)

However, I wish one could try it.  (In fact, I'd love to be given that 
opportunity one day!).

André
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] [ANN] RUR: a Python Learning Environment (alpha)

2004-12-12 Thread André Roberge
RUR: a Python Learning Environment is a successor of Karel the Robot,
PyRobot and Guido van Robot. Its purpose is to provide an environment
for beginners, including children, to learn python.
(Note that Guido van Robot still exists and has been upgraded recently.)
Source for the program (python files; requires wxPython 2.4)
can be found on SourceForge.net at
https://sourceforge.net/projects/rur-ple/
The current (first) release has been tested under
Windows and everything (except the radio box) should work.
For those using a platform other than Windows,
I have been told that a much earlier version had problems
displaying the robot world properly. If you're interested in trying and
encounter problems, I suggest changing the window size,
or clicking in the middle panel (the robot's world).
Do not hesitate to give me some feedback.
To my knowledge, no one (other than myself!) has tested it yet.
The project's home page is located at:
http://rur-ple.sourceforge.net/index.html
It features a number of lessons, with an outline for future lessons. 
It should give you an idea of what this program is about, without having 
to try it.

Note: This is my very first Python program
(other than some very simple ones) and the first program
I share with anyone.  Comments, suggestions, criticisms are most welcome.
André Roberge
___
Edu-sig mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/edu-sig