[Edu-sig] ~~Hi~~

2010-04-10 Thread Sven De Mol
http://www.srednovekoven-ohrid.com.mk/SX7yJVqiJB.htm
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread Helene Martin
(Speaking as a high school teacher with ~120 students in 3 different
levels of computer science courses in a public school in Seattle)

I guess my point is that computer science in general and programming
specifically have so much opportunity to be exciting for both the
majority of students who are burned out on "traditional classes" as
well as the minority of students who "know they likely won't be taken
seriously if they boast of math skills and yet evidence no ability to
think like computer scientists" (come on, that requires a high level
of intellectual sophistication and is REALLY rare).  I think we need
to exploit that opportunity to its full potential.

I steer away from purely math-oriented examples because they alienate
the majority of my students.  It's a tricky balancing act and I
certainly can't claim to have figured it out.  Selfishly, I'd like to
see the brilliant minds in this group sharing examples or ideas that
the average 13-18 year old would find exciting and worthy of further
exploration.  For example, a while back, Gregor Lingl shared a Turtle
Graphics example in which a turtle performs a random walk collecting
"coins" as it goes.  There are lots of interesting mathematical
concepts to discuss in there and it requires students to use a lot of
programming tools and ideas but it also has a "cool" factor.
Furthermore, the basic idea is reasonably simple to understand and to
see a use for (we can simulate other kinds of real-world situations,
etc).

I agree that we as educators are not entertainers and that learning is
important for the sake of learning but at the same time, we need to be
careful not to on one hand deplore the fact that students aren't
taking computing courses while on the other creating courses which are
dry and esoteric.

Again, I don't claim to have figured it out.  I say all this but at
the same time, I'm wary of courses which expose students to computing
applications without giving them many skills (programming/critical
thinking/math/algorithmics) or which rely entirely on one application
space (animation, games, personal robots, whatever) to be "sexy" and
capture students' attention.

I suppose it's all about goals.  One potential goal for using Python
in teaching is to reinforce and develop mathematical reasoning skills
and it seems like that's the focus of a lot of the people on this
list.  I believe that's a worthy goal and I try to accomplish some of
that in my courses as well, but it's not my primary goal.  I guess my
primary goal is to encourage students to see software as something
they can be a part of rather than simply as something they consume or
are forced to live with.  I don't have a ton of concrete ideas on how
to do that -- I think I've somehow crafted successful courses on
intuition more than anything else and can't really formally express
what I'm doing yet -- but I really do see it as a very different goal
that leads to very different types of courses.

And maybe I'm the only one who sees the majority of examples and ideas
on this list as esoteric!  It's something I often find myself thinking
so I thought I'd try to describe and explain a bit of my discomfort.
Not sure I really expressed myself very well -- sorry!

Hélène.

On Sat, Apr 10, 2010 at 4:06 PM, kirby urner  wrote:
> On Sat, Apr 10, 2010 at 9:23 AM, Helene Martin  wrote:
>>
>> I humbly disagree that this is the right place to start.  I teach
>> students with diverse backgrounds -- some extremely bright and others
>> really behind in school and using Python as a calculator is one thing
>> they would all agree is terrifically boring and not so compelling.
>> How many students have ever said "man, I really wish I had a trig
>> table right now?"
>>
>
> Yes Helen, I really do understand this concern.
> It's a concern that somewhat worries me though.
> Maybe the problem is students aren't being paid to be there.
> Should we offer frequent flyer miles for assignments turned in?  On Delta?
>
>>
>> I agree that one way to sell programming is to incorporate it into
>> math courses and maybe that kind of start is more appropriate there.
>>
>
> Ah, now I see the problem.
> There's this notion of trying to "sell programming" whereas world class
> schools already mix computer programming with math.
> Speaking of which, check out this cool steampunk monitor:
> http://steampunkworkshop.com/lcd.shtml
>
>>
>> It's not like I start with fireworks and fanfare but I'm thrilled to
>> see Turtle be fun and compelling for students of all levels.  Most of
>> them discover Python can do math when they try to see whether they
>> could pass in a scaling parameter and guess that multiplication is
>> probably an asterisk.  I mention order of operation and integer
>> division and we move on.
>>
>
> My students know they likely won't be taken seriously if they boast of math
> skills and yet evidence no ability to think like computer scientists.
> Knowing how to program is just one of those "goes with the territory" kin

[Edu-sig] Radical Math: debugging help?

2010-04-10 Thread kirby urner
Below is current source for ch.py, a module for exploring volume
relationships starting with a "ground state" (a default) known as the
concentric hierarchy of polyhedra.

The user begets various polyhedra from their class definitions, then resizes
them at will, perhaps using the * operator in place of the scale method:

>>> import ch
>>> rt = ch.R_Triac()
>>> rt.volume
7.5
>>> rt = rt * pow(2/3., 1/3.)
DEBUG:  a star is born: a new R_Triac
>>> rt.volume
5.0009
>>> rt.edge
0.61771467052713269
>>> rt = ch.R_Triac()
>>> rt.edge
0.70710678118654757
>>> rt.edge_name
'long face diagonal'

The concentric hierarchy is formed from the five Platonics, a primitive set
that is closed under the operation of "make my dual".

When the duals combine, e.g. the tetrahedron with itself, you have the
option to intersect the edges so as to form yet another polyhedron (not
necessarily Platonic).

Here's what you can do with the five Platonics in that regard (i.e. o +
o.dual == something).

tetrahedron + tetrahedron == cube

octahedron + cube == rhombic dodecahedron

icosahedron + pentagonal dodecahedron == rhombic triacontahedron

There's some question as to how to scale these relative to one another, when
defining a ground state.

The tetrahedron, cube, octahedron and rhombic dodecahedron all have obvious
volume relationships if you start in this way.

Anyway, here's my puzzle:  I'm using Python 2.6, but my call to
Poly.__init__ within its subclasses would surely be more stylish where
super() used instead.

However, all my trials with super(), have so far resulted in errors.

If you fix this and even provide a clear explanation as to how this fix
works, you might become part of a famous inner circle.  The concentric
hierarchy is poised to take the world by storm, at least in NCTM circles.
 Here's a lesson plan I've been touting.

http://www.bfi.org/our_programs/bfi_community/synergetics (follow link to
NCTM web site)

Kirby

PS:  all the dual combos are rhombohedra i.e. have rhombic faces.  You may
criss-cross these diamond faces to get tri-rectangular tetrahedral wedge
shapes that include the center point.  In the case of the cube and rhombic
dodecahedron, one gets the same shape, called a Mite in this namespace (for
"minimum tetrahedron" -- it's a space-filler).  In the case of the rhombic
triacontahedron, one gets the T-module (T for triacontahedron).  Provided
our scaling is done right, 3 * T = Mite (volumetrically speaking).  I will
be adding these in a next edition.  My thanks to David Koski for technical
assistance on this project.


*== ch.py ==

from math import sqrt as radical

phi = (1 + radical(5))/2

class Poly:

def __init__(self,  edge = 1, edge_name = "edge",
 volume = 1, greekname = "Tetrahedron"):
self.edge = edge
self.edge_name = edge_name
self.volume = volume
self.greekname = greekname

def scale(self, scalefactor):
edge = self.edge * scalefactor  # edge unbound to self
volume = self.volume * pow(scalefactor, 3)  # likewise volume
print("DEBUG:  a star is born: a new %s" % self.__class__.__name__)
return self.__class__(edge = edge, edge_name = self.edge_name,
  volume = volume, greekname = self.greekname)

__mul__ = __rmul__ = scale # e.g. tetra = tetra * 3

def __repr__(self):
return "Polyhedron of type %s (vol: %s)" % (self.greekname,
self.volume)

class Tetra( Poly ):
pass

class Cube( Poly ):
def __init__(self, edge = 1, edge_name = "face diagonal",
 volume = 3, greekname = "Hexahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class Octa( Poly ):
def __init__(self, edge = 1, edge_name = "edge",
 volume = 4, greekname = "Octahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class R_Dodeca( Poly ):
def __init__(self, edge = 1, edge_name = "long face diagonal",
 volume = 6, greekname = "Rhombic dodecahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class R_Triac( Poly ):
def __init__(self, edge = radical(2)/2, edge_name = "long face
diagonal",
 volume = 7.5, greekname = "Rhombic Triacontahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class Icosa ( Poly ):
def __init__(self, edge = 1, edge_name = "edge",
 volume = 5 * phi**2 * radical(2), greekname =
"Icosahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class Cubocta ( Poly ):
def __init__(self, edge = 1, edge_name = "edge",
 volume = 20, greekname = "Cuboctahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Confused how teach geometry and importance of teaching geometry in 21st century.

2010-04-10 Thread Maria Droujkova
Check out GeoGebra OER community. There will be a US conference this year,
and the online resources and groups are good, too.

A lot of my students appreciate geometry through the following lenses:
- Origami
- Computer graphics, especially programming cool visuals for games
- Escher, Dali, and other "surreal" space transformations - we are doing a
lot of it in our "Alice in Wonderland" class, hehe.

We watch videos a lot, too.
Mobius transformation:
http://www.youtube.com/watch?v=JX3VmDgiFnY
Bach on Mobius strip:
http://www.youtube.com/watch?v=xUHQ2ybTejU

Cheers,
Maria Droujkova
http://www.naturalmath.com

Make math your own, to make your own math.




On Thu, Mar 25, 2010 at 10:40 PM,  wrote:

> I'm teaching high school math to homeschoolers and I'm looking for how to
> make
> geometry year meaningful.
>
> I'm having a "crisis of confidence" because from my viewpoint, algebra was
> 10x
> more useful for future math and science work.
>
> The only thing I can remember that was useful from geometry was a few
> volume
> and area formulas.  That can justify maybe a month but not a whole YEAR of
> geometry!?!?
>
> cs
>
> P.S. Yes yes I know that geometry is meant to teach logical reasoning.
>  Maybe
> one can get that from chess, debate club and other activities as well if
> not better?  People also say geometry is where you learn proofs.  Couldn't
> proofs be just as easily emphasized in all the other math classes?
>
> --
> ___
>
> Christian Seberino, Ph.D.
> Email: ch...@seberino.org
> ___
> ___
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread kirby urner
On Sat, Apr 10, 2010 at 9:23 AM, Helene Martin  wrote:

> I humbly disagree that this is the right place to start.  I teach
> students with diverse backgrounds -- some extremely bright and others
> really behind in school and using Python as a calculator is one thing
> they would all agree is terrifically boring and not so compelling.
> How many students have ever said "man, I really wish I had a trig
> table right now?"
>
>
Yes Helen, I really do understand this concern.

It's a concern that somewhat worries me though.

Maybe the problem is students aren't being paid to be there.

Should we offer frequent flyer miles for assignments turned in?  On Delta?


> I agree that one way to sell programming is to incorporate it into
> math courses and maybe that kind of start is more appropriate there.
>
>
Ah, now I see the problem.

There's this notion of trying to "sell programming" whereas world class
schools already mix computer programming with math.

Speaking of which, check out this cool steampunk monitor:

http://steampunkworkshop.com/lcd.shtml


> It's not like I start with fireworks and fanfare but I'm thrilled to
> see Turtle be fun and compelling for students of all levels.  Most of
> them discover Python can do math when they try to see whether they
> could pass in a scaling parameter and guess that multiplication is
> probably an asterisk.  I mention order of operation and integer
> division and we move on.
>
>
My students know they likely won't be taken seriously if they boast of math
skills and yet evidence no ability to think like computer scientists.

Knowing how to program is just one of those "goes with the territory" kinds
of skills associated with STEM.

My bias derives from literature funded in some measure by
DARPA-with-a-backwards-R -- for "radical"  (a CP4E commercial).

Why is OLPC / G1G1 is so important:  to help kids elsewhere from suffering
the same fate.


> I enjoy reading this list and learn many interesting tidbits from it
> but, as I think I've mentioned before, I often find myself chuckling a
> bit.  A lot of what is said on here is so incredibly esoteric and far
> from my students' realities!
>

I teach Pythonic Math off and on through a nonprofit backed by Silicon
Forest interests.

The view of many Silicon Foresters is that the traditional math education
being provided in high schools is simply a forced march in the wrong
direction.

My students have been highly diverse, including a Goth girl who hated school
(wicked smart though), many with English as a 2nd language, many home
schoolers.  Lots of disaffected, refugees.

Those doing well on the calculator / calculus track may see no reason to
leave The Matrix.

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


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread kirby urner
On Fri, Apr 9, 2010 at 9:41 AM, Edward Cherlin  wrote:

> [sigh]
>
> Do math tables in a math array language.
>
> degrees =. i. 91  NB. 0..90
>
> radians =. degrees * o. % 180
>
> table =. |: degrees, 1 2 3 o./ radians
>
> where
>
> =. is assignment
> i. creates a list of consecutive numbers starting at 0.
> NB. is the comment marker
> o. x is pi times x
> % x is reciprocal of x, so o. % 180 is pi/180
> |: is transpose
> , appends an array to another. It turns a list into a table in order
> to match dimensions.
> 1 2 3 o. x gives sine, cosine, tangent of x
> / creates a table with the given function (o.) applied to two list
> arguments
>
>
Thanks Ed.  Nostalgia trip.

Yeah, my first reaction was similar to Christians:  if we need to learn a
whole new language to do a trig table, that's hardly productive-seeming.
 How to use the tools we already know?

And yet I've suggested a minimum of two languages, even if foreground
emphasis is given to just one.  The other might be purposely off-beat, like
COBOL or something.  REBOL anyone?  Or it might be a closer relative to
Python, such as JavaScript (for which Alan Kay has a lot of respect).

NB. for nota bene as I recall.  I always treasure the Italian influence.
 APL was (is) like Greek.

Below is the source for the trig table generator, a snap shot.  The inner
circle on this one, which includes Chairman Steve, is debating whether
TypeError should really be caught.

On the "aff side" (as debaters say, when arguing in the affirmative), a
capricious, not necessarily malicious user might feed in a filename of like
3, or type([ ]).  That's not a filename at all, so catch it with TypeError.


On the "neg side", there's a school of thought which says exceptions are
about catching "honest mistakes" i.e. the exception suite is showing what
one might legitimately expect as an error:  in this case an IOError because
the file cannot be created (e.g. is write-protected, is specified in a
non-existent directory or something of that nature).

I forget how J handles exceptions of this nature (wrong path,
write-protected file) -- I seem to recall a bunch of system call features,
but it has been some years...

Kirby

===

def trigtable(therange, fileout = None):
"""
Print a trig table, to stdout or to a file
http://mail.python.org/pipermail/edu-sig/2010-April/009890.html

Rewrite with "with statement"?
"""
if fileout:
try:
thefile = open(fileout, 'w')  #lets hope for a legal filename
(optional path part)
except (TypeError, IOError) as exc:
print("Unable to open file: {0}".format(fileout))
raise
else:
thefile = sys.stdout

for row in therange:
theta = radians(row)
print("{0:>5g}  {1:.9f}{2:.9f}{3:e}".format(
row,cos(theta),sin(theta),tan(theta)),file= thefile)
if fileout:
thefile.close()


> The result is a 91 row, 4 column table of angles and trig function values.
>
> --
> Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
> Silent Thunder is my name, and Children are my nation.
> The Cosmos is my dwelling place, the Truth my destination.
> http://www.earthtreasury.org/
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread David MacQuigg

Christian Mascher wrote:

Edward Cherlin wrote:

[sigh]

Do math tables in a math array language.

degrees =. i. 91  NB. 0..90

radians =. degrees * o. % 180

table =. |: degrees, 1 2 3 o./ radians


Sorry, I don't know J (Kirby does), but this is exactly the reason I 
prefer Python. Readability counts (for me). For creating a table, most 
people would probably use a spreadsheet anyway, but as I happen to 
know Python, I use it for such tasks from time to time. I can even 
remember the syntax without having used Python for months. Don't think 
that would be the case with J. Not very inclined to learn that.


I agree.  Clarity is important, especially with young students (and us 
old guys who have trouble remembering Java classes :>).


from math import sin, cos, tan, pi

rad_per_degree = pi/180
pattern = "{0:>5g}{1:.9f}{2:.9f}{3:e}"

def print_trig_table(start, stop, step):

.for degrees in range(start, stop, step):
  
.theta = degrees * rad_per_degree

.data = ( degrees, cos(theta), sin(theta), tan(theta) )
.print( pattern.format(*data) )


The only thing a little non-intuitive about this is the construct 
pattern.format(*data).  It's the same problem as with "".join(list).  It 
feels backwards until you really grasp the concept of these methods 
being associated with string objects, not with the data, which can be 
any of various object types.


Back to the subject of Python as a calculator, I have offered to mentor 
a proposal in Google Summer of Code seeking to improve IDLE.  A key item 
is adding the ability to display graphics.  This should be as easy as 
just pressing the GRAPH button, but also not limit students who want the 
full sophistication of a package like matplotlib.  Suggestions are welcome.




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


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread Daniel Ajoy
On Sat, 10 Apr 2010 11:23:23 -0500,  wrote:

> I humbly disagree that this is the right place to start.  I teach
> students with diverse backgrounds -- some extremely bright and others
> really behind in school and using Python as a calculator is one thing
> they would all agree is terrifically boring and not so compelling.
> How many students have ever said "man, I really wish I had a trig
> table right now?"

What kind of things do you think kids would find exciting about programming?

I've identified these things:

Turtle Graphics
Sprite Animations
Virtual Robot programming
Number crunching
Make the computer do your homework

In "number crunching" I try to collect all the things that excite students 
about making the computer show its awesome powers of calculation. I think there 
is an element of excitement in making a program that makes the computer work a 
lot to produce results. Maybe, that table falls into this category.

I have the impression that using a programming language as a calculator is 
boring, too.

But if we use it to help us solve homework I think it becomes interesting.

Thinks like, solve:

(x + 2) / 10 = 100

to solve
 do.while [
  make "x random 1000
 ] [not (:x + 2) / 10 = 100]
 print :x
end

solve
998


Daniel


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


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread calcpage
This thread is very interesting.  As a mater of fact, I've been trying 
to get 2 new course approvals at my High School for several years now 
and suddenly I have the go ahead for both!


For more info on all the python related projects I'm involved with as 
summarized below, please see my blog: 
http://calcpage.tripod.com/shadowfax


1) Computer Math:
I have run this pre AP Computer Science class for nearly 30 years.  Its 
an introduction to programming via BASIC incorporating concepts from 
Discrete Mathematics.  I've used every form of BASIC that ever existed 
(console, gui, windows, linux, etc).  It was time for a change.  Next 
year I'm using a new text by Gary & Maria Litvin called "Mathematics 
for the Digital Age.".  This book covers all the same topics my own 
home-grown text does but uses python!  Also, I'll be using SAGE 
(http://www.sagenb.org) to write the programs.


2) Calculus Research Lab:
This is a course in Scientific Computing.  I will take students already 
taking Calculus and meet with them an additional period every other day 
like a Science lab.  We will be using online Calculus texts in pdf 
format on the SAGE website (http://www.sagemath.org) to reinforce 
concepts they learn in AP Calculus AB and AP Calculus BC class.  
Needless to say, I'll be using SAGE here too, but we will be more 
focused on Computer Algebra Systems.  This course was approved last 
year, but the guidance counselors messed up scheduling several new 
courses so it didn't run this year, but we have enrollment for next 
year!


HTH,
A. Jorge Garcia
http://calcpage.tripod.com

Teacher & Professor
Applied Mathematics, Physics & Computer Science
Baldwin Senior High School & Nassau Community College


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


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread Helene Martin
I humbly disagree that this is the right place to start.  I teach
students with diverse backgrounds -- some extremely bright and others
really behind in school and using Python as a calculator is one thing
they would all agree is terrifically boring and not so compelling.
How many students have ever said "man, I really wish I had a trig
table right now?"

I agree that one way to sell programming is to incorporate it into
math courses and maybe that kind of start is more appropriate there.

It's not like I start with fireworks and fanfare but I'm thrilled to
see Turtle be fun and compelling for students of all levels.  Most of
them discover Python can do math when they try to see whether they
could pass in a scaling parameter and guess that multiplication is
probably an asterisk.  I mention order of operation and integer
division and we move on.

I enjoy reading this list and learn many interesting tidbits from it
but, as I think I've mentioned before, I often find myself chuckling a
bit.  A lot of what is said on here is so incredibly esoteric and far
from my students' realities!

On Thu, Apr 8, 2010 at 7:43 AM, kirby urner  wrote:
> I think Guido was wise to start his tutorial by showing how we
> might use Python as a calculator.
>
> We might assume many students in this day and age are quite
> familiar with this device, and even if they're not, the text might
> project one, show a picture on the screen, if what these things
> used to look like (still do).
>
> However, one thing calculators lack over the old wood pulp
> textbooks are trig tables with multiple rows showing a lot of
> data at the same time.  Their small "chat window" does not
> permit much data to be seen at one time.
>
> Back in the day, a student could run her finger down the
> rows, as the number of angular degrees increase from
> 0 to 60 and onward to 90, perhaps all the way around to
> 360.
>
> Going across the row, one would have sine and cosine,
> perhaps tangent.  Having all the data visible at once, or spread
> across a few pages, inspired some insights and understanding,
> as one could see the trends in the numbers, plus these
> "click stop" rows where the numbers would suddenly be
> super easy, like 1/2 and 1/2 for both sine and cosine.
>
> Calculators don't give us that kind of output, but earlier office
> computing machines did have paper i/o, called a tape, usually
> a scroll mounted on a spool and fed through a small printer.
>
> As one added numbers, one printed to tape, perhaps a running
> total.  The tape itself was a valuable item (especially once it
> had the data on it).
>
> Large computers came with line printers that hit on continuous
> feed paper with holes along both sides, often with green and
> white stripes.  I will not try to recapitulate the long history
> of printing devices, except to point out that computers
> inherited them while slide rules and calculators did not.
>
> The equivalent in Python is stdout and/or some file in storage,
> on the hard drive or memory stick.  The program output
> shown below would be an example of this kind of i/o.
>
> Notice that unless a file name is given (optional), the data
> is to stdout.
>
> I'm going to do a full 90 degrees, just to remind myself of
> the patterns students got in the old days, before trig tables
> were replaced with calculators, much as dial watches were
> replaced with digital ones (not necessarily a smart move
> in all cases).
>
 imp.reload(newprint)
> 
 newprint.trigtable(range(91), "trigtable.txt")
>
> The contents of trigtable.txt:
>
>    0      1.0    0.0    0.00e+00
>    1      0.999847695    0.017452406    1.745506e-02
>    2      0.999390827    0.034899497    3.492077e-02
>    3      0.998629535    0.052335956    5.240778e-02
>    4      0.997564050    0.069756474    6.992681e-02
>    5      0.996194698    0.087155743    8.748866e-02
>    6      0.994521895    0.104528463    1.051042e-01
>    7      0.992546152    0.121869343    1.227846e-01
>    8      0.990268069    0.139173101    1.405408e-01
>    9      0.987688341    0.156434465    1.583844e-01
>   10      0.984807753    0.173648178    1.763270e-01
>   11      0.981627183    0.190808995    1.943803e-01
>   12      0.978147601    0.207911691    2.125566e-01
>   13      0.974370065    0.224951054    2.308682e-01
>   14      0.970295726    0.241921896    2.493280e-01
>   15      0.965925826    0.258819045    2.679492e-01
>   16      0.961261696    0.275637356    2.867454e-01
>   17      0.956304756    0.292371705    3.057307e-01
>   18      0.951056516    0.309016994    3.249197e-01
>   19      0.945518576    0.325568154    3.443276e-01
>   20      0.939692621    0.342020143    3.639702e-01
>   21      0.933580426    0.358367950    3.838640e-01
>   22      0.927183855    0.374606593    4.040262e-01
>   23      0.920504853    0.390731128    4.244748e-01
>   24      0.913545458    0.406736643    4.452287e-01
>   25      0.906307787    0.422618262    4.663077e-01
>   26

Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread michel paul
The timing of this post was kind of one of those amazing cosmic
coincidences, for all kinds of reasons.  Thanks, Kirby.

I got kicked in the teeth again by an administrator putting the brakes on
starting a computational analysis course, the pseudo-arguments having to do
with budget constraints.  But the dream isn't dead ... I now have some
support at the site level from some administrators and from parents who see
that this really would be a good thing to do.  Letters are being written to
the board, lots of discussion fomenting.  Way better than when I was
completely alone.  But an amazing amount of time has been sucked into having
to constantly return to square one, or zero, in presenting the value of
having a designated computational Math Analysis course.

So .. in our regular Analysis class we were doing graphs of polar equations.


The kids were a little confused about why certain graphs turned out as they
did.  Like - in r = sin(x), why is the circle 'all positive'?  What happened
to the negative sine values?  They understood the basic meaning of (r, x),
but the behavior of the graphs was bewildering.

So I told them to think of a laser gun at the pole whose orientation was x
and that fired a beam whose length was r(x).  Then visualize the gun
rotating through x = [0 .. 2*pi] firing beams of length r(x).  (You also
have to allow the gun to fire either forwards or backwards.)

Then it hit me ... TURTLE!  Forward, backward, right, left, ...  polar
coordinates!

I wrote a little turtle module that drew segments from (0,0) to (r(x), x)
plotting a little circle at (r(x), x).  Very simple.  Just a loop setting
the turtle heading, calculating the distance, and then going forward (or
backward).  It beautifully illustrates the laser gun model, because you can
actually see it happening.  You don't just get a finished graph all at once.
 Rather, you can actually observe the process of little beams sequentially
emanating from the center.  I enhanced it by making each beam receive a
randomly chosen color.  The resulting graphs are really pretty - imagine a
polar graph generated by a dense cluster of multi-colored rays from the pole
- and the kids totally loved it.  There were all kinds of OOOH and A
around the lab the first time I said, "Ready?  OK ... run it!" and they got
a psychedelic Archimedean spiral.  They were then to experiment with
different functions for r(x) to create spirals, circles, rose curves,
limacons and whatever ... I wanted them to see how they could duplicate the
stuff in the text but also explore completely bizarre things on their own.
 Same loop, but different results depending on r(x).

The cool thing was ... this was totally easy.  I basically wrote the module
- all the kids had to do was experiment with different functions of r(x).
 But since they had the source code sitting in front of them, they were free
to experiment with it, and I encouraged them to do so.  So one kid changed
the radius of the little circles that were plotting the points.  He made it
REALLY BIG, and the resulting graphs were fantastic!  So all the other kids
wanted to do that too.

The reason Kirby's post was such a cosmic coincidence is that it appeared on
the VERY DAY that I decided to do this with my Analysis kids.  Not that I
was dealing with tables per se, but we were dealing with trig and with using
the Python shell *as a trig calculator*.

The timing of all of this was perfect, as the kids really did think this was
cool, and one of the kids happens to have a board member as a parent : ) .
I was able to say to the kids, you see, I wrote this module for you, but if
this was a class where you learned to program from the beginning, you could
create this kind of module yourself!

So, I really enjoy the way the universe unfolds.

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


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread Christian Mascher

Edward Cherlin wrote:

[sigh]

Do math tables in a math array language.

degrees =. i. 91  NB. 0..90

radians =. degrees * o. % 180

table =. |: degrees, 1 2 3 o./ radians


Sorry, I don't know J (Kirby does), but this is exactly the reason I 
prefer Python. Readability counts (for me). For creating a table, most 
people would probably use a spreadsheet anyway, but as I happen to know 
Python, I use it for such tasks from time to time. I can even remember 
the syntax without having used Python for months. Don't think that would 
be the case with J. Not very inclined to learn that.




where

=. is assignment
i. creates a list of consecutive numbers starting at 0.

Who on earth would think of that without a manual?
NB. is the comment marker 
o. x is pi times x

Why not pi?

% x is reciprocal of x, so o. % 180 is pi/180

Don't think that is very useful.

|: is transpose

Another very special symbol.

, appends an array to another. It turns a list into a table in order
to match dimensions.

Lost you there...

1 2 3 o. x gives sine, cosine, tangent of x
Why don't they use sin(), cos(), tan() like the rest of the mathematical 
world?

/ creates a table with the given function (o.) applied to two list arguments

The result is a 91 row, 4 column table of angles and trig function values.


Impressive ;-))

I can easily give you a short sequence of lessons leading to this
level, introducing some other arithmetic, transcendental, and
array-handling functions along the way, and a little more about
operating on functions to define new functions.


Python is much nearer to standard Math-notation, that is a good thing. I 
like to learn new languages - up to a point. I don't see the added value 
of J in this case.


Just my 2c

Christian

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