# [Edu-sig] Python and pre-Calculus

Daniel Ajoy da.ajoy at gmail.com
Sat Sep 9 23:57:46 CEST 2006

```On 8 Sep 2006 at 18:00, edu-sig-request at python.org wrote:

> From: "Kevin Driscoll" <driscollkevin at gmail.com>
> Subject: [Edu-sig] Python and pre-Calculus
>
> I'm teaching Pre-Calculus for the first time this year and am hoping
> to integrate Python as often as possible.  My syllabus is focused on
> exploring functions in various forms, uses, and contexts.  The
> intersections to programming are numerous and beautiful.
>
> I'd love to get a brainstorm happening here.  Especially addressing
> the college educators, what do you which your freshman had seen in
>
> Yesterday we worked on building a complete mathematical definition for
> a Toaster function.  Wouldn't you know it?  toaster(bread) = toast ...
> every time!

What happens when you enter: toaster(hand)?

I'm brainstorming now:

It is good that machines be reliable so that with a certain input we
can only obtain a specific output. We can't input something and
obtain nothing. We can input something at diferent times and obtain
different outputs.

* Take two x's and apply your function to obtain their corresponding
y's . You can talk about the rate of change: by how much does Y
changes when we go from x=1 to x=2? Does Y change by the same
ammount if we go from x=10 to x=11?

* The car analogy: at any given moment a car has a certain speed.
If our function is

SpeedAt(time)

can we calculate the value of the speed of the car, say at time= 10

What happens if the car made stops? What happens if at some
point we decided that we were running late and decided to go faster?

We can program

SpeedAt(time)

with if's like

if time between 0 and 1 then speed = 10 * time
if time between 1 and 10 then speed = 10
if time between 10 and 11 then speed = -10 * time + 110
if time between 11 and 12 then speed = 10 * time - 110
if time between 12 and 30 then speed = 10
if time between 30 and 32 then speed = 5 * time - 140
if time between 32 and 99 then speed = 20
if time between 99 and 100 then speed = -20 * time - 2000

accelation is the rate of change of velocity. How much
does velocity change between 1 and 5?

SpeedAt(5)-SpeedAt(1) / (5-1)

How much does it change between 11 and 12?

Program a function

RateOfChange(start,finish)

How much does it change between 0 and 100? But that's
an average acceleration. At some points during the trip
the car had postive accelerations and at some points it
had negative accelerations, all those canceled out.

But at any give time the car has an acceleration, (probably=0)
this is an instantaneous acceleration. How would you calculate
the acceleration at time = 13? or at time = 31?

The answer is the invention of epsilon. and the definition of
derivative.

Then write the program:

InstantaneousRateOfChange(time)

if

SpeedAt(time) = -0.2 * time ^ 2 + 4 * time

how does InstantaneousRateOfChange(time) behave? how does
its plot look like? Is this plot a line? Using points
in the plot can you come up with the equation of this line?
Oh, it's

IROC = -0.4 * time + 4

... how interesting...

* Can you know the "Distance from home" by only knowing
how SpeedAt(time) behaves. The answer is the concept of
integration. A program can be made that approximates the
integrals using Riemann (sp?) sums.

* The mid interval theorem is directly related with the strategy
for solving the "guess a number" game. This is called the
Bisection method for finding roots.

Daniel

```