[Edu-sig] Help with Jupyter Notebook, please?

Andre Roberge andre.roberge at gmail.com
Thu Jun 15 10:36:27 EDT 2017


On Thu, Jun 15, 2017 at 11:09 AM, A. Jorge Garcia via Edu-sig <
edu-sig at python.org> wrote:

>
> OK, I never used a Jupyter notebook before, but I've used Python from the
> command line on my Linux Box and on SAGE for years.
>
> Anyway, here's my problem. My AP Calculus BC students have used a TI
> nSpire CX CAS Graphing Calculuator all year. In our final project, I
> collected the Graphing Calculators and I'm trying to show these students
> how to use other computing environments. On the AP Exam, roughly half the
> questions are calculator active. However, the Graphing Calculator used need
> only do these 4 operations (ie no CAS):
> 1) Graph a function in a user defined window,
> 2) Solve equations numerically,
> 3) Calculate Derivatives at a point numerically and
> 4) Evaluate Definite Integrals numerically.
> By numerically we mean in decimal form usually rounded to 3 decimal places
> (and in scientific or engineering notation if answers are too large or too
> small).
>
> So, here's my SAGE Worksheet from cocalc.com (aka SMC aka
> http://cloud.sagemath.com) accomplishing these 4 tasks:
> https://cocalc.com/projects/9b02cebf-ad0d-4213-a57b-32979ac7
> 240f/files/Calculus%20Summary%20SAGE%20style.sagews
> And here's my Jupyter Notebook from cocalc.com accomplishing these 4
> tasks:
> https://cocalc.com/projects/9b02cebf-ad0d-4213-a57b-32979ac7
> 240f/files/summary.ipynb
>
> The problem is that we tried doing the same thing when solving this year's
> AP Exam's FRQs and I FUBARed the Jupyter Notebook version!
> Here's my SAGE Worksheet from cocalc.com (with correct answers)
> https://cocalc.com/projects/77404da1-af58-43f6-aac9-60bc5b24
> bb1a/files/2017AB2-SAGE.sagews
> And here's my Jupyter notebook from cocalc.com but parts 2b and 2c are
> wrong???
> https://cocalc.com/projects/77404da1-af58-43f6-aac9-60bc5b24
> bb1a/files/NEW:%202017%20AB2%20Python.ipynb
>

On line 17, you have a print statement without parentheses ... this
indicates that it is running Python 2 and you are likely doing integer
division with unexpected results.


Without using Jupyter, here's what I get from one of your tests:


Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  5 2016, 11:41:13)
[MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import sin, log
>>> def f(t):
...   return 10 + 0.8*t * sin(t**3/100)
...
>>> def diff(x, h):
...   return (f(x+h) - f(x))/h
...
>>> for x in range(5):
...   print(diff(7, 10**-x))
...
-4.282867047679119
-8.137863980094284
-8.124544588531002
-8.120073755899071
-8.119596547775387



Python 2.7.12 |Continuum Analytics, Inc.| (default, Jun 29 2016, 11:07:13)
[MSC v.1500 64 bit (AMD64)] on win32
>>> from math import sin, log
>>> def f(t):
...   return 10 + 0.8*t*sin(t**3/100)
...
>>> def diff(x, h):
...   return (f(x+h) - f(x))/h
...
>>> for x in range(5):
...   print diff(7, 10**-x)
...
-6.92738740298
-31.9684243335
-246.430148122
-2391.1761091
-23838.6799499
>>>


André

>
>
> So, what did I miss? I'm sure it's something glaringly obvious! Or am I
> making some sort of conceptional error or misunderstanding the new Jupyter
> paradigm?
>
> BTW, here's the AP Exam FRQ section in question:
> https://secure-media.collegeboard.org/ap/pdf/ap-calculus-ab-frq-2017.pdf
>
> Any help would be greatly appreciated!
>
> Thanx in advance,
> A. Jorge Garcia
> http://shadowfaxrant.blogspot.com
> http://www.youtube.com/calcpage2009
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> https://mail.python.org/mailman/listinfo/edu-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20170615/f4dd0af3/attachment.html>


More information about the Edu-sig mailing list