using Python as a calculator

classic Classic list List threaded Threaded
44 messages Options
123
Reply | Threaded
Open this post in threaded view
|

using Python as a calculator

kirby urner-4
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)
<module 'newprint' from 'C:\Python26\lib\site-packages\newprint.py'>
>>> newprint.trigtable(range(91), "trigtable.txt")

The contents of trigtable.txt:

    0      1.000000000    0.000000000    0.000000e+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      0.898794046    0.438371147    4.877326e-01
   27      0.891006524    0.453990500    5.095254e-01
   28      0.882947593    0.469471563    5.317094e-01
   29      0.874619707    0.484809620    5.543091e-01
   30      0.866025404    0.500000000    5.773503e-01
   31      0.857167301    0.515038075    6.008606e-01
   32      0.848048096    0.529919264    6.248694e-01
   33      0.838670568    0.544639035    6.494076e-01
   34      0.829037573    0.559192903    6.745085e-01
   35      0.819152044    0.573576436    7.002075e-01
   36      0.809016994    0.587785252    7.265425e-01
   37      0.798635510    0.601815023    7.535541e-01
   38      0.788010754    0.615661475    7.812856e-01
   39      0.777145961    0.629320391    8.097840e-01
   40      0.766044443    0.642787610    8.390996e-01
   41      0.754709580    0.656059029    8.692867e-01
   42      0.743144825    0.669130606    9.004040e-01
   43      0.731353702    0.681998360    9.325151e-01
   44      0.719339800    0.694658370    9.656888e-01
   45      0.707106781    0.707106781    1.000000e+00
   46      0.694658370    0.719339800    1.035530e+00
   47      0.681998360    0.731353702    1.072369e+00
   48      0.669130606    0.743144825    1.110613e+00
   49      0.656059029    0.754709580    1.150368e+00
   50      0.642787610    0.766044443    1.191754e+00
   51      0.629320391    0.777145961    1.234897e+00
   52      0.615661475    0.788010754    1.279942e+00
   53      0.601815023    0.798635510    1.327045e+00
   54      0.587785252    0.809016994    1.376382e+00
   55      0.573576436    0.819152044    1.428148e+00
   56      0.559192903    0.829037573    1.482561e+00
   57      0.544639035    0.838670568    1.539865e+00
   58      0.529919264    0.848048096    1.600335e+00
   59      0.515038075    0.857167301    1.664279e+00
   60      0.500000000    0.866025404    1.732051e+00
   61      0.484809620    0.874619707    1.804048e+00
   62      0.469471563    0.882947593    1.880726e+00
   63      0.453990500    0.891006524    1.962611e+00
   64      0.438371147    0.898794046    2.050304e+00
   65      0.422618262    0.906307787    2.144507e+00
   66      0.406736643    0.913545458    2.246037e+00
   67      0.390731128    0.920504853    2.355852e+00
   68      0.374606593    0.927183855    2.475087e+00
   69      0.358367950    0.933580426    2.605089e+00
   70      0.342020143    0.939692621    2.747477e+00
   71      0.325568154    0.945518576    2.904211e+00
   72      0.309016994    0.951056516    3.077684e+00
   73      0.292371705    0.956304756    3.270853e+00
   74      0.275637356    0.961261696    3.487414e+00
   75      0.258819045    0.965925826    3.732051e+00
   76      0.241921896    0.970295726    4.010781e+00
   77      0.224951054    0.974370065    4.331476e+00
   78      0.207911691    0.978147601    4.704630e+00
   79      0.190808995    0.981627183    5.144554e+00
   80      0.173648178    0.984807753    5.671282e+00
   81      0.156434465    0.987688341    6.313752e+00
   82      0.139173101    0.990268069    7.115370e+00
   83      0.121869343    0.992546152    8.144346e+00
   84      0.104528463    0.994521895    9.514364e+00
   85      0.087155743    0.996194698    1.143005e+01
   86      0.069756474    0.997564050    1.430067e+01
   87      0.052335956    0.998629535    1.908114e+01
   88      0.034899497    0.999390827    2.863625e+01
   89      0.017452406    0.999847695    5.728996e+01
   90      0.000000000    1.000000000    1.633124e+16

Here's the print function I used to generate the above.

                print("{0:>5g}      {1:.9f}    {2:.9f}    {3:e}".format(
                            row,        cos(theta), sin(theta),tan(theta)),
                      end="\n", file= thefile)

My module starts with:

from __future__ import printfunction

which is why I get to use this in 2.6

So why use Python as a calculator again?  Because it's more like
an old office machine with a tape, and that restores some of what
was lost when lookup tables went out of style.  I should do log10
next, using range with a step or something....  Also, the trig tape
should probably be 0-360 but I didn't want to waste paper. :)

Kirby
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

Mokurai
[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

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

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.

J is no-charge software from JSoftware.com. We are discussing the
possibility of a GPLed version.

When you do such function tables, it is extremely helpful to show the
first differences. The differences of sine are approximately
proportional to cosine, and of cosine are proportional to the
negatives of sine.

On Thu, Apr 8, 2010 at 10:43, kirby urner <[hidden email]> 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)
> <module 'newprint' from 'C:\Python26\lib\site-packages\newprint.py'>
>>>> newprint.trigtable(range(91), "trigtable.txt")
>
> The contents of trigtable.txt:
>
>    0      1.000000000    0.000000000    0.000000e+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      0.898794046    0.438371147    4.877326e-01
>   27      0.891006524    0.453990500    5.095254e-01
>   28      0.882947593    0.469471563    5.317094e-01
>   29      0.874619707    0.484809620    5.543091e-01
>   30      0.866025404    0.500000000    5.773503e-01
>   31      0.857167301    0.515038075    6.008606e-01
>   32      0.848048096    0.529919264    6.248694e-01
>   33      0.838670568    0.544639035    6.494076e-01
>   34      0.829037573    0.559192903    6.745085e-01
>   35      0.819152044    0.573576436    7.002075e-01
>   36      0.809016994    0.587785252    7.265425e-01
>   37      0.798635510    0.601815023    7.535541e-01
>   38      0.788010754    0.615661475    7.812856e-01
>   39      0.777145961    0.629320391    8.097840e-01
>   40      0.766044443    0.642787610    8.390996e-01
>   41      0.754709580    0.656059029    8.692867e-01
>   42      0.743144825    0.669130606    9.004040e-01
>   43      0.731353702    0.681998360    9.325151e-01
>   44      0.719339800    0.694658370    9.656888e-01
>   45      0.707106781    0.707106781    1.000000e+00
>   46      0.694658370    0.719339800    1.035530e+00
>   47      0.681998360    0.731353702    1.072369e+00
>   48      0.669130606    0.743144825    1.110613e+00
>   49      0.656059029    0.754709580    1.150368e+00
>   50      0.642787610    0.766044443    1.191754e+00
>   51      0.629320391    0.777145961    1.234897e+00
>   52      0.615661475    0.788010754    1.279942e+00
>   53      0.601815023    0.798635510    1.327045e+00
>   54      0.587785252    0.809016994    1.376382e+00
>   55      0.573576436    0.819152044    1.428148e+00
>   56      0.559192903    0.829037573    1.482561e+00
>   57      0.544639035    0.838670568    1.539865e+00
>   58      0.529919264    0.848048096    1.600335e+00
>   59      0.515038075    0.857167301    1.664279e+00
>   60      0.500000000    0.866025404    1.732051e+00
>   61      0.484809620    0.874619707    1.804048e+00
>   62      0.469471563    0.882947593    1.880726e+00
>   63      0.453990500    0.891006524    1.962611e+00
>   64      0.438371147    0.898794046    2.050304e+00
>   65      0.422618262    0.906307787    2.144507e+00
>   66      0.406736643    0.913545458    2.246037e+00
>   67      0.390731128    0.920504853    2.355852e+00
>   68      0.374606593    0.927183855    2.475087e+00
>   69      0.358367950    0.933580426    2.605089e+00
>   70      0.342020143    0.939692621    2.747477e+00
>   71      0.325568154    0.945518576    2.904211e+00
>   72      0.309016994    0.951056516    3.077684e+00
>   73      0.292371705    0.956304756    3.270853e+00
>   74      0.275637356    0.961261696    3.487414e+00
>   75      0.258819045    0.965925826    3.732051e+00
>   76      0.241921896    0.970295726    4.010781e+00
>   77      0.224951054    0.974370065    4.331476e+00
>   78      0.207911691    0.978147601    4.704630e+00
>   79      0.190808995    0.981627183    5.144554e+00
>   80      0.173648178    0.984807753    5.671282e+00
>   81      0.156434465    0.987688341    6.313752e+00
>   82      0.139173101    0.990268069    7.115370e+00
>   83      0.121869343    0.992546152    8.144346e+00
>   84      0.104528463    0.994521895    9.514364e+00
>   85      0.087155743    0.996194698    1.143005e+01
>   86      0.069756474    0.997564050    1.430067e+01
>   87      0.052335956    0.998629535    1.908114e+01
>   88      0.034899497    0.999390827    2.863625e+01
>   89      0.017452406    0.999847695    5.728996e+01
>   90      0.000000000    1.000000000    1.633124e+16
>
> Here's the print function I used to generate the above.
>
>                print("{0:>5g}      {1:.9f}    {2:.9f}    {3:e}".format(
>                            row,        cos(theta), sin(theta),tan(theta)),
>                      end="\n", file= thefile)
>
> My module starts with:
>
> from __future__ import printfunction
>
> which is why I get to use this in 2.6
>
> So why use Python as a calculator again?  Because it's more like
> an old office machine with a tape, and that restores some of what
> was lost when lookup tables went out of style.  I should do log10
> next, using range with a step or something....  Also, the trig tape
> should probably be 0-360 but I didn't want to waste paper. :)
>
> Kirby
> _______________________________________________
> Edu-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig
>



--
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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

michel paul-2
In reply to this post by kirby urner-4
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 AHHHH 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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

Helene Martin
In reply to this post by kirby urner-4
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 <[hidden email]> 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)
> <module 'newprint' from 'C:\Python26\lib\site-packages\newprint.py'>
>>>> newprint.trigtable(range(91), "trigtable.txt")
>
> The contents of trigtable.txt:
>
>    0      1.000000000    0.000000000    0.000000e+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      0.898794046    0.438371147    4.877326e-01
>   27      0.891006524    0.453990500    5.095254e-01
>   28      0.882947593    0.469471563    5.317094e-01
>   29      0.874619707    0.484809620    5.543091e-01
>   30      0.866025404    0.500000000    5.773503e-01
>   31      0.857167301    0.515038075    6.008606e-01
>   32      0.848048096    0.529919264    6.248694e-01
>   33      0.838670568    0.544639035    6.494076e-01
>   34      0.829037573    0.559192903    6.745085e-01
>   35      0.819152044    0.573576436    7.002075e-01
>   36      0.809016994    0.587785252    7.265425e-01
>   37      0.798635510    0.601815023    7.535541e-01
>   38      0.788010754    0.615661475    7.812856e-01
>   39      0.777145961    0.629320391    8.097840e-01
>   40      0.766044443    0.642787610    8.390996e-01
>   41      0.754709580    0.656059029    8.692867e-01
>   42      0.743144825    0.669130606    9.004040e-01
>   43      0.731353702    0.681998360    9.325151e-01
>   44      0.719339800    0.694658370    9.656888e-01
>   45      0.707106781    0.707106781    1.000000e+00
>   46      0.694658370    0.719339800    1.035530e+00
>   47      0.681998360    0.731353702    1.072369e+00
>   48      0.669130606    0.743144825    1.110613e+00
>   49      0.656059029    0.754709580    1.150368e+00
>   50      0.642787610    0.766044443    1.191754e+00
>   51      0.629320391    0.777145961    1.234897e+00
>   52      0.615661475    0.788010754    1.279942e+00
>   53      0.601815023    0.798635510    1.327045e+00
>   54      0.587785252    0.809016994    1.376382e+00
>   55      0.573576436    0.819152044    1.428148e+00
>   56      0.559192903    0.829037573    1.482561e+00
>   57      0.544639035    0.838670568    1.539865e+00
>   58      0.529919264    0.848048096    1.600335e+00
>   59      0.515038075    0.857167301    1.664279e+00
>   60      0.500000000    0.866025404    1.732051e+00
>   61      0.484809620    0.874619707    1.804048e+00
>   62      0.469471563    0.882947593    1.880726e+00
>   63      0.453990500    0.891006524    1.962611e+00
>   64      0.438371147    0.898794046    2.050304e+00
>   65      0.422618262    0.906307787    2.144507e+00
>   66      0.406736643    0.913545458    2.246037e+00
>   67      0.390731128    0.920504853    2.355852e+00
>   68      0.374606593    0.927183855    2.475087e+00
>   69      0.358367950    0.933580426    2.605089e+00
>   70      0.342020143    0.939692621    2.747477e+00
>   71      0.325568154    0.945518576    2.904211e+00
>   72      0.309016994    0.951056516    3.077684e+00
>   73      0.292371705    0.956304756    3.270853e+00
>   74      0.275637356    0.961261696    3.487414e+00
>   75      0.258819045    0.965925826    3.732051e+00
>   76      0.241921896    0.970295726    4.010781e+00
>   77      0.224951054    0.974370065    4.331476e+00
>   78      0.207911691    0.978147601    4.704630e+00
>   79      0.190808995    0.981627183    5.144554e+00
>   80      0.173648178    0.984807753    5.671282e+00
>   81      0.156434465    0.987688341    6.313752e+00
>   82      0.139173101    0.990268069    7.115370e+00
>   83      0.121869343    0.992546152    8.144346e+00
>   84      0.104528463    0.994521895    9.514364e+00
>   85      0.087155743    0.996194698    1.143005e+01
>   86      0.069756474    0.997564050    1.430067e+01
>   87      0.052335956    0.998629535    1.908114e+01
>   88      0.034899497    0.999390827    2.863625e+01
>   89      0.017452406    0.999847695    5.728996e+01
>   90      0.000000000    1.000000000    1.633124e+16
>
> Here's the print function I used to generate the above.
>
>                print("{0:>5g}      {1:.9f}    {2:.9f}    {3:e}".format(
>                            row,        cos(theta), sin(theta),tan(theta)),
>                      end="\n", file= thefile)
>
> My module starts with:
>
> from __future__ import printfunction
>
> which is why I get to use this in 2.6
>
> So why use Python as a calculator again?  Because it's more like
> an old office machine with a tape, and that restores some of what
> was lost when lookup tables went out of style.  I should do log10
> next, using range with a step or something....  Also, the trig tape
> should probably be 0-360 but I didn't want to waste paper. :)
>
> Kirby
> _______________________________________________
> Edu-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig
>
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

A. Jorge Garcia
In reply to this post by michel paul-2
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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

Daniel Ajoy-2
In reply to this post by kirby urner-4
On Sat, 10 Apr 2010 11:23:23 -0500, <[hidden email]> 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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

David MacQuigg
In reply to this post by Christian Mascher
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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

kirby urner-4
In reply to this post by Mokurai
On Fri, Apr 9, 2010 at 9:41 AM, Edward Cherlin <[hidden email]> 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

    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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

kirby urner-4
In reply to this post by Helene Martin
On Sat, Apr 10, 2010 at 9:23 AM, Helene Martin <[hidden email]> 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:

 
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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

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 <[hidden email]> wrote:

> On Sat, Apr 10, 2010 at 9:23 AM, Helene Martin <[hidden email]> 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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

kirby urner-4
On Sat, Apr 10, 2010 at 9:25 PM, Helene Martin <[hidden email]> wrote:
>
> (Speaking as a high school teacher with ~120 students in 3 different
> levels of computer science courses in a public school in Seattle)
>

That's hard work and you have my respect for it.

I started out as a full time high school teacher, mostly math, but only
stayed with St. Dominic Academy (Jersey City) for two years.

Later I wound up at McGraw-Hill and looked from the text book publisher
angle (I was on the 28th floor of a skyscraper in Rockefeller Center,
commuting from my friend Ray Simon's apartment in Brooklyn.

> 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).
>

Yes, and I would not want to get in your way.

What I like to do in some of my classes (I still get teaching gigs through
the private sector) is show up with an XO or two, those One Laptop per
Child gizmos that Ed does Turtle Art for.

Our XO HQS in Portland, Oregon is one Duke's Landing on SE Belmont,
where Michael D. is tending mine among others, got me a developer's key
and everything, upgraded me to the latest Sugar.

http://www.flickr.com/search/?q=XO&w=17157315@N00
(tagged with XO in my Photostream)

http://www.flickr.com/photos/17157315@N00/4104822975/
http://www.flickr.com/photos/17157315@N00/4105591168/
(at Duke's specifically)

The Python application that puts Python most in one's scope is called
Pippy.  The fact that Sugar itself is a Python program will escape notice
unless they somehow get access to this lore, through a teacher or other
peer, perhaps via the Web.

The last gig I did was for a Free School event near Duke's, a place
called Flipside around the corner from Muddy Water's.

http://worldgame.blogspot.com/2010/03/radical-math.html

Anyway, that's a lot of Portland geography most people here won't know
(check Google Earth if curious, or Google Street Views -- here's Duke's

http://preview.tinyurl.com/ydeyzjl

).

Also, in the public sector, I took the whole of Winterhaven's 8th
grade for a spin.  Winterhaven is a one of Portland public's and a
kind of geek Hogwarts for some families.  It only goes up through
middle school though (8th grade).

What I taught there was a mixture of Python and GIS/GPS subjects,
per recommendations from other faculty.

The thinking has evolved since then to where we might adapt this for
high schools by having kids actually venture forth from their buildings
in teams, riding the buses and such, following various clues -- a kind
of geocaching as an organized sport, but also an academic exercise.

I could send links, but this is already pretty long.

Here's a peak at some of the work that we accomplished at
Winterhaven.

http://www.4dsolutions.net/ocn/winterhaven/

> 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.
>

What we're trying to get off the ground in Oregon are pilot classes
that go towards the 3 year math requirement (mandatory for a h.s.
diploma) yet include computer programming as a part of the content,
maybe (I personally would hope) more of this GIS/GPS stuff.

It's a math course in other words, and yet Python might be used
for a language, like if teachers go with the Litvins' text, which I highly
recommend, among others.  In a hands-on music class, students
pick an instrument.  In hands-on math, you pick a computer
language (at least one, but one leads to another if a student
gets curious).

I just got a mailing from Saturday Academy today in fact, listing
some of my students for such a class at Reed College (just a
short pilot).  I call my portion Martian Math and have pages on
Wikieducator about it.  These will be younger students than I'm
used to.

My associate Glenn Stockton is doing Neolithic Math and Tai Chi
with the same group.  Neolithic Math, like Martian Math, is just
branding we're using, hoping to keep things interesting.

In terms of content, you'd want to look at the write-up, but it
includes Euclidean basics such as the Vesica Pices and
generating edge lengths with string and stick (compass and
ruler), using these edges in constructions (such as polyhedra).

You may have seen the polyhedra go by in a short script
here recently.

Obviously some of this material is further down the timeline than
either the Paleolithic, Neolithic or Mesolithic eras.  Some of it is
downright futuristic, which is where my Martian Math stuff kicks
in.

We try to provide some continuity in our students' experience,
picking up on some cues from Ralph Abraham at the Oregon Math
Summit in 1997, Sir Roger Penrose a keynote.  He suggested a
more time-line based approach, more direct linking to history.

> 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'm wary of math classes that use boring calculators.

When I say lets use Python as a calculator instead of using a calculator,
I'm talking about stopping using calculators in math class and using
Python instead.

Picture the NCTM conference with a Ruby booth, a Scheme booth,
a J booth and so on.  This is the National Council of Teachers of
Mathematics and yet industrial strength computer languages are
treated on a par with the calculators.  What a concept!

Hooray for less bigotry against thinking like computer scientists.
'Concrete Mathematics' broke some ice maybe.

> 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.
>

I appreciate your commitment to keeping interest levels high.

You rightly point out how I risk coming across as some kind of
killjoy by wanting to take a colorful bright computer and make it
seem like a boring old calculator.

Of all the fun and interesting things one might do...

But I'm not talking about using it *exclusively* in that way.

> 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.
>

I think "esoteric" and/or "avant-garde" are fair characterizations.

I'm glad you've joined us here, as a fully participating individual and
professional, Seattle-based -- just 3.5 hours from here by car on I-5,
for those of you unfamiliar with this bio-region.

I'm wondering if you've gone through Allen Downey's work, and/or
Jeff Elkner's:

http://www.greenteapress.com/thinkpython/thinkpython.html

This book is free to public schools (is free period).

If a school is spending big bucks on a textbook about programming,
this could be a savings, especially with Python itself being both
free and open source.

Here's a rave review by Hong Feng of Allen's book in the series about Java.

http://www.free-soft.org/FSM/english/issue01/bookreview.html

Whereas I'm a huge fan of Python, I wouldn't discourage using some
Java or JavaScript in a math class as well.

I'm all about leaving it to local faculties to create their own courseware.

As long as teachers retain their professional freedom to innovate,
I think we'll gradually see more of these math and computer science
hybrids that include more geography (Google Earth etc.).

Kirby
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

Mokurai
In reply to this post by Christian Mascher
On Sat, Apr 10, 2010 at 09:33, Christian Mascher
<[hidden email]> 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).

That's what they said to Fibonacci when he tried to explain why Arabic
numerals were better for math than Roman numerals. But Roman numerals
are better in readability and algorithmic complexity if you rarely do
anything but add and subtract, as merchants did before interest
payments became critical. Roman numerals are precisely equivalent to
abacus notation. It is odd that the distinction between math/science
programming and business programming is nearly a thousand years old,
but there it is.

In fact, APL is the only computer language that uses the same symbols,
+ - × ÷, as first grade arithmetic texts. (Presumably, with the
acceptance of Unicode, this will change someday.) Back in the 1960s,
Ken Iverson successfully taught teachers how to teach children
arithmetic on IBM Selectric terminals connected to a loaned 360
mainframe. An addition table up to 10 is simply

numbers =. i. 11  NB. 0..10

numbers +/ numbers

or, with a bit more complexity or a bit more simplicity, depending on
your viewpoint,

+/~ i. 11

where f~ x is x f x .

> 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.

This turns out not to be the case. The complete syntax table for J
consists of 12 lines. You are talking glibly about a topic on which
you have no information.

> Not very inclined to learn that.

Obviously.

>> where
>>
>> =. is assignment
>> i. creates a list of consecutive numbers starting at 0.
>
> Who on earth would think of that without a manual?

And without a lesson? Do you believe that Python syntax is intuitive,
and can be guessed without a manual or lessons? In i., the i stands
for index. It is easy to learn, and reasonably mnemonic.

>> NB. is the comment marker o. x is pi times x
>
> Why not pi?

Why?

>> % x is reciprocal of x, so o. % 180 is pi/180
>
> Don't think that is very useful.

These objections are trivial and uninformed. You aren't a
mathematician, you don't like math and math notation, so there is
nothing more to say, except please stand out of the way of people who
can benefit from it and want it.

>> |: 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...

You can append a table to a table if they have a dimension in common.
You can't append a table to a list unless the list is turned into a
one-row table.

>> 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.

LOL. Math notation is what mathematicians use, not schoolchildren.
They are constantly inventing more of it. What you call math notation
is known to mathematicians as "arithmetic".

There is no standard math notation.

Polish: + 1 2
Infix: 1 + 2
Reverse Polish: 1 2 +

Reverse Polish is one of the two standard calculator input systems,
the one used by engineers, from HP. Polish is standard in LISP and
combinatory logic. Neither requires parentheses. Infix notation, as on
TI and related calculators, requires parentheses, and is much more
difficult for complex expressions.

> I
> like to learn new languages - up to a point. I don't see the added value of
> J in this case.

I like to learn languages a lot more than you, then. I don't consider
anybody educated in computing without knowing something of languages
from the LISP, APL, FORTH, OOP, and scalar language families.

> Just my 2c
>
> Christian
>
> _______________________________________________
> Edu-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig
>



--
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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

Helene Martin
Since I've been vocal over the past few days, I'd like to point out
that this is a very negative post.  Here's what I got out of it: "You
don't know math, you don't know this list of programming languages so
you're not a True Member of the Computation World and if you knew
anything about this, you clearly wouldn't say such foolish things."  I
know that's not exactly what you said, but read over your post to see
how it may be the case that that's how it comes across, starting with
the sigh of exasperation in your original post.

Christian makes frequent interesting and intelligent posts so why not
assume that his opinion is grounded in valid experience?  I found his
remarks very important because they're trying to mitigate some of the
esoteric nature of the conversation.

I take particular offense to your closing statement -- "I don't
consider anybody educated in computing without knowing something of
languages from the LISP, APL, FORTH, OOP, and scalar language
families."  First of all, you've just called many of us uneducated
which I'd argue somewhat lacks in tact.  You're also reinforcing the
idea that computing is this select club that only people with specific
experiences and interests have access to.  Do the majority of computer
scientists care much about APL/MATLAB/J/etc?  I know several who use
it all the time and several others, myself included, who really
haven't had much of a need for those.  I take it we are out of the
club?  Keep in mind you're excluding lots of folks with PhDs and
interesting projects under their belt.

As an educator, I find this attitude troubling, though I know that's
less relevant to you since you're not currently in the classroom.
Think about the effect this kind of attitude can have on folks who are
just starting to develop an interest in computing, especially those
who have reasons to think they don't belong right off the bat (women,
minorities).  Something to consider.

On Sun, Apr 11, 2010 at 12:00 PM, Edward Cherlin <[hidden email]> wrote:

> On Sat, Apr 10, 2010 at 09:33, Christian Mascher
> <[hidden email]> 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).
>
> That's what they said to Fibonacci when he tried to explain why Arabic
> numerals were better for math than Roman numerals. But Roman numerals
> are better in readability and algorithmic complexity if you rarely do
> anything but add and subtract, as merchants did before interest
> payments became critical. Roman numerals are precisely equivalent to
> abacus notation. It is odd that the distinction between math/science
> programming and business programming is nearly a thousand years old,
> but there it is.
>
> In fact, APL is the only computer language that uses the same symbols,
> + - × ÷, as first grade arithmetic texts. (Presumably, with the
> acceptance of Unicode, this will change someday.) Back in the 1960s,
> Ken Iverson successfully taught teachers how to teach children
> arithmetic on IBM Selectric terminals connected to a loaned 360
> mainframe. An addition table up to 10 is simply
>
> numbers =. i. 11  NB. 0..10
>
> numbers +/ numbers
>
> or, with a bit more complexity or a bit more simplicity, depending on
> your viewpoint,
>
> +/~ i. 11
>
> where f~ x is x f x .
>
>> 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.
>
> This turns out not to be the case. The complete syntax table for J
> consists of 12 lines. You are talking glibly about a topic on which
> you have no information.
>
>> Not very inclined to learn that.
>
> Obviously.
>
>>> where
>>>
>>> =. is assignment
>>> i. creates a list of consecutive numbers starting at 0.
>>
>> Who on earth would think of that without a manual?
>
> And without a lesson? Do you believe that Python syntax is intuitive,
> and can be guessed without a manual or lessons? In i., the i stands
> for index. It is easy to learn, and reasonably mnemonic.
>
>>> NB. is the comment marker o. x is pi times x
>>
>> Why not pi?
>
> Why?
>
>>> % x is reciprocal of x, so o. % 180 is pi/180
>>
>> Don't think that is very useful.
>
> These objections are trivial and uninformed. You aren't a
> mathematician, you don't like math and math notation, so there is
> nothing more to say, except please stand out of the way of people who
> can benefit from it and want it.
>
>>> |: 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...
>
> You can append a table to a table if they have a dimension in common.
> You can't append a table to a list unless the list is turned into a
> one-row table.
>
>>> 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.
>
> LOL. Math notation is what mathematicians use, not schoolchildren.
> They are constantly inventing more of it. What you call math notation
> is known to mathematicians as "arithmetic".
>
> There is no standard math notation.
>
> Polish: + 1 2
> Infix: 1 + 2
> Reverse Polish: 1 2 +
>
> Reverse Polish is one of the two standard calculator input systems,
> the one used by engineers, from HP. Polish is standard in LISP and
> combinatory logic. Neither requires parentheses. Infix notation, as on
> TI and related calculators, requires parentheses, and is much more
> difficult for complex expressions.
>
>> I
>> like to learn new languages - up to a point. I don't see the added value of
>> J in this case.
>
> I like to learn languages a lot more than you, then. I don't consider
> anybody educated in computing without knowing something of languages
> from the LISP, APL, FORTH, OOP, and scalar language families.
>
>> Just my 2c
>>
>> Christian
>>
>> _______________________________________________
>> Edu-sig mailing list
>> [hidden email]
>> http://mail.python.org/mailman/listinfo/edu-sig
>>
>
>
>
> --
> 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
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig
>
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: using Python as a calculator

kirby urner-4
In reply to this post by Mokurai
>> Sorry, I don't know J (Kirby does), but this is exactly the reason I prefer
>> Python. Readability counts (for me).
>
> That's what they said to Fibonacci when he tried to explain why Arabic
> numerals were better for math than Roman numerals. But Roman numerals
> are better in readability and algorithmic complexity if you rarely do
> anything but add and subtract, as merchants did before interest
> payments became critical. Roman numerals are precisely equivalent to
> abacus notation. It is odd that the distinction between math/science
> programming and business programming is nearly a thousand years old,
> but there it is.
>

Fibonacci's Liber Abaci introduced the Indian/Arabic number system,
based on the abacus.  The place value system corresponds to the
rods of the abacus, with the zero corresponding to a rod with no beads
(a place holder).

Roman numerals, in contrast, have nothing to do with abacus notation
and have no place value e.g XIV for 14 or MMMCCC for 3300.

http://www.novaroma.org/via_romana/numbers.html

Roman numbers suck for arithmetic operations of any kind IMO.

> numbers =. i. 11  NB. 0..10
>

...similar to Python's range built-in.

> These objections are trivial and uninformed. You aren't a
> mathematician, you don't like math and math notation, so there is
> nothing more to say, except please stand out of the way of people who
> can benefit from it and want it.
>

One could argue any computer language comprises a math notation.

Also, one could argue that all creatures are mathematicians in some
innate way (Keith Devlin's point).

Carving out a special caste of humans and calling them "mathematicians"
is a practice within various institutions.

I've noticed many of these institutions promote a kind of snobbery,
but then such is the human ego.

> You can append a table to a table if they have a dimension in common.
> You can't append a table to a list unless the list is turned into a
> one-row table.
>

Note that numpy shares some of APL's and J's ability to shape data
into multi-dimensional objects with rank.

>>> import numpy
>>> a = numpy.array(range(10))
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> a.reshape((2,5))
array([[0, 1, 2, 3, 4],
       [5, 6, 7, 8, 9]])
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> a = a.reshape((2,5))
>>> a
array([[0, 1, 2, 3, 4],
       [5, 6, 7, 8, 9]])
>>> numpy.concatenate((a,a))
array([[0, 1, 2, 3, 4],
       [5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4],
       [5, 6, 7, 8, 9]])
>>> numpy.concatenate((a,a), axis=1)
array([[0, 1, 2, 3, 4, 0, 1, 2, 3, 4],
       [5, 6, 7, 8, 9, 5, 6, 7, 8, 9]])

>>> 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.
>
> LOL. Math notation is what mathematicians use, not schoolchildren.

Math notations, like music notations, are the common heritage of
humankind, not the special property of an elite caste of human.

That being said, many math notations, including computer languages,
are quite opaque until deciphered.

Those already "in the know" may exult in their exclusive knowledge,
that's been true since time immemorial.

Those cryptic expressions on a T-shirt from the MIT gift shop serve
as mnemonics, are reminders of long hours spent unpacking the
meanings.

To a non-initiate, it all looks like so much unreadable APL. :)

Of course non-math notations share in these encrypting / compacting
capabilities.  You needn't use math notations to create operational
systems (institutions) with their respective insiders and outsiders,
with insiders often ranked according to their "degree" of inner-ness.

We've not really defined "mathematics", "mathematician" or
"math notation" for the purposes of this thread, so maybe one
could argue that all notations are inherently mathematical in
that they're aids to thought processes, which processes by their
very nature are computational in some degree.

Is Chinese a math notation?  Write a 500 word essay on why it
is.  Write another 500 word essay on why it isn't.

> They are constantly inventing more of it. What you call math notation
> is known to mathematicians as "arithmetic".
>

Iverson called APL an executable math notation (MN).  MNs were
divided into machine-executable and not.

Leibniz dreamed of machine-executable logical languages.  We have
them now, call them "computer languages".

> There is no standard math notation.
>

Nor is there a strongly fixed meaning to the concept of "math
notation".  Is Python a math notation?  One could argue that it
is.  Or call it a machine-executable logic.

> Polish: + 1 2
> Infix: 1 + 2
> Reverse Polish: 1 2 +
>
> Reverse Polish is one of the two standard calculator input systems,
> the one used by engineers, from HP. Polish is standard in LISP and
> combinatory logic. Neither requires parentheses. Infix notation, as on
> TI and related calculators, requires parentheses, and is much more
> difficult for complex expressions.
>
>> I like to learn new languages - up to a point. I don't see the added value of
>> J in this case.
>
> I like to learn languages a lot more than you, then. I don't consider
> anybody educated in computing without knowing something of languages
> from the LISP, APL, FORTH, OOP, and scalar language families.
>

"Like" may not be the operative word in all cases.  Some people just
don't have the privilege to study that much.  I wish that they did.

Socrates worked with that slave boy to show how intelligence was
innate, but he didn't manage to abolish slavery.

This is clearly a Python list, so I'm never going to apologize for showing
a Pythonic solution or implementation that could just as well be done
in another language in far fewer steps.

I'm happy to have APL and J mentioned for comparing and contrasting
(I mention them myself), but if one judges one needs to stick with
Python for a given task (because it's what they know, and because
the task is looming), then it's hardly my place to judge them mentally
and/or morally deficient in some way.

>> Just my 2c
>>
>> Christian
>>

Thanks for your remarks Christian.  Don't let this Ed character bully
or intimidate you.  He likes to show off, which is fine, but he lacks
diplomatic skills IMO.  But then some say the same about me.

Kirby

>> _______________________________________________
>> Edu-sig mailing list
>> [hidden email]
>> http://mail.python.org/mailman/listinfo/edu-sig
>>
>
>
>
> --
> 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
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig
>
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Why Python?

David MacQuigg
In reply to this post by Mokurai
Edward Cherlin wrote:

> On Sat, Apr 10, 2010 at 09:33, Christian Mascher
> <[hidden email]> 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
>>>      

<snip>

>> Python is much nearer to standard Math-notation, that is a good thing.
>>    
>
> LOL. Math notation is what mathematicians use, not schoolchildren.
> They are constantly inventing more of it. What you call math notation
> is known to mathematicians as "arithmetic".
>
> There is no standard math notation.
>  

I think what Christian means to say is that Python is much nearer to a
notation (pseudocode) that might be used by scientists and engineers who
are trying to express an idea involving computation, without relying on
a specific language.  Of course, there is no "standard" pseudocode, but
if you look at textbooks that are most successful at expressing
algorithms this way (my examples would be from engineering - Hachtel &
Somenzi on Logic Synthesis, Stinson on Cryptography) what you see is a
notation very close to Python.

Pseudocode has to be self-explanatory.  There is no introductory chapter
on how to read it.  Likewise, an introductory computer language should
be close to self-explanatory.  It will be difficult to get math and
science teachers to accept it, if they have to make extra efforts
explaining the notation.  Getting math and science teachers to accept
computation as a vital part of their curricula is my current focus, so I
wouldn't try to push something like your example above.

Python is just a means to an end, the closest thing we have to
pseudocode.  When someone who favors another language (typically Java)
asks me why Python, I find the comparison to pseudocode to be the best
answer.  Specific examples, like the absence of type declarations, tends
to invite unthinking reactions.  (Students will make too many errors.)  
Even something as simple as requiring correct indentation is not obvious
to someone who hasn't used Python.  (Although that one does have some
appeal to teachers who have had to read sloppy student code.)  
Ultimately, it is word-of-mouth, one teacher telling another, that I
think will decide which language gets used.

-- Dave

************************************************************     *
* 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          *
************************************************************     *


_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Why Python?

Andrew Harrington
Well put David.

My choices are always about me and a particular situation.  I would not teach J to beginners or to people not crunching a lot of mathematical stuff regularly, but for the professional statisticians and electronic traders I know, J is a fabulous language, and very worth the modest learning curve. 

J is an interesting case.  Iverson did not totally open up the source.  JSoftware still sells that to big users who want extra insurance for the future of their codebase, but the very powerful language is freely available.  The statisticians in my university are talking about dumping traditional massively expensive statistical environments, not for a switch to some Python tool, but to J and its freely available libraries.

I fear I sometimes push Python in ways that can easily be interpreted as meaning for essentially all people and all situations.  I know that inside my head I am not thinking about so general a situation, but I think I could often communicate it better.

Andy

On Sun, Apr 11, 2010 at 6:50 PM, David MacQuigg <[hidden email]> wrote:
Edward Cherlin wrote:
On Sat, Apr 10, 2010 at 09:33, Christian Mascher
<[hidden email]> 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
     

<snip>

Python is much nearer to standard Math-notation, that is a good thing.
   

LOL. Math notation is what mathematicians use, not schoolchildren.
They are constantly inventing more of it. What you call math notation
is known to mathematicians as "arithmetic".

There is no standard math notation.
 

I think what Christian means to say is that Python is much nearer to a notation (pseudocode) that might be used by scientists and engineers who are trying to express an idea involving computation, without relying on a specific language.  Of course, there is no "standard" pseudocode, but if you look at textbooks that are most successful at expressing algorithms this way (my examples would be from engineering - Hachtel & Somenzi on Logic Synthesis, Stinson on Cryptography) what you see is a notation very close to Python.

Pseudocode has to be self-explanatory.  There is no introductory chapter on how to read it.  Likewise, an introductory computer language should be close to self-explanatory.  It will be difficult to get math and science teachers to accept it, if they have to make extra efforts explaining the notation.  Getting math and science teachers to accept computation as a vital part of their curricula is my current focus, so I wouldn't try to push something like your example above.

Python is just a means to an end, the closest thing we have to pseudocode.  When someone who favors another language (typically Java) asks me why Python, I find the comparison to pseudocode to be the best answer.  Specific examples, like the absence of type declarations, tends to invite unthinking reactions.  (Students will make too many errors.)  Even something as simple as requiring correct indentation is not obvious to someone who hasn't used Python.  (Although that one does have some appeal to teachers who have had to read sloppy student code.)  Ultimately, it is word-of-mouth, one teacher telling another, that I think will decide which language gets used.

-- Dave

************************************************************     *
* 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          *
************************************************************     *


_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig



--
Andrew N. Harrington
 Director of Academic Programs
 Computer Science Department
 Loyola University Chicago
 512B Lewis Towers (office)
 Snail mail to Lewis Towers 416
 820 North Michigan Avenue
 Chicago, Illinois 60611

http://www.cs.luc.edu/~anh
Phone: 312-915-7982
Fax:    312-915-7998
[hidden email] for graduate administration
[hidden email] for undergrad administration
[hidden email] as professor

_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Why Python?

chris-218
In reply to this post by David MacQuigg
On Sun, Apr 11, 2010 at 04:50:34PM -0700, David MacQuigg wrote:
> Python is just a means to an end, the closest thing we have to
> pseudocode.

I agree with you.  I've heard people say that Scheme is the most like algebra.
I don't know exactly what that means or if that means Scheme is the simplest
introductory language.  My hunch is that Python is better.

cs
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Why Python?

A. Jorge Garcia
As a Computer Science teacher, I am used to teaching my students a
number of introductory languages before they get to AP CS.  I am never
satisfied with just one approach.  I am going to dump all that in favor
of python next year.  So, if Computer Science teachers end up using
python, I will be in the odd position of teaching only python for 2
years of High School.  You know, that wouldn't be all bad, my students
would then have a lot more experience with python before the AP exam.  
As a Math teacher, this scenario is also appealing as I would have more
time fo math topics too (Discrete Math or Pythonic Math)!

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
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Why Python?

chris-218
In reply to this post by David MacQuigg
On Sun, Apr 11, 2010 at 09:51:48PM -0400, [hidden email] wrote:
> As a Computer Science teacher, I am used to teaching my students a
> number of introductory languages before they get to AP CS.  I am never
> satisfied with just one approach.  I am going to dump all that in favor
> of python next year.  So, if Computer Science teachers end up using
> python, I will be in the odd position of teaching only python for 2
> years of High School.  You know, that wouldn't be all bad, my students
> would then have a lot more experience with python before the AP exam.
> As a Math teacher, this scenario is also appealing as I would have more
> time fo math topics too (Discrete Math or Pythonic Math)!

Jorge

I've enjoyed your comments on AP Calc list and now here.  Ever heard of
Teach Scheme/Reach Java (http://http://www.teach-scheme.org)?  I like the idea
of starting the AP CS year with a clean language and then "reaching" or
finishing with Java.

I wonder if AP CS with Python and Java would be ideal.

Ideally we would have the same kids for a few years so that we could really
sail in math classes with kids that know Python fairly well.

cs
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
123