From kirby.urner at gmail.com Sun Oct 7 17:52:17 2018 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 7 Oct 2018 14:52:17 -0700 Subject: [Edu-sig] adventures in using Python as a calculator Message-ID: A stereotype some people have, of computers, is they're like giant calculators on steroids. Then they find as much "text processing" goes on as "number crunching" -- ala "regular expressions" -- and forget about the calculator model. Calculators don't do strings, let alone much in the way of data files. Of course that line got blurred in the golden age of programmable calculators (HP65 etc.). However, the Python docs start with Using Python as a Calculator in Guido's tutorial. Perhaps we could do more to fulfill the "on steroids" expectations (that the computer is a "beefed up" calculator device) by exploring our number types in more depth, and in particular by exploiting their superhuman abilities in the extended precision department. Yes, the int type is awesome, now that it integrates long int (for those new to Python, these used to be separate), but lets not forget Decimal and also... gmpy, or actually gmpy2. I've probably lost even some seasoned Python teachers in jumping to that relatively obscure third party tool, providing extended precision numeracy beyond what Decimal (in Standard Library) will do. gmpy has a long history, predating Python. I'm not the expert in the room. In particular, it does trig. Our Python User Group used to get one of the package maintainers from nearby Mentor Graphics (Wilsonville). He was adding complex numbers to the gmpy mix, and was in touch with Alex Martelli. I enjoyed our little chats. Without having all the higher level math it might take to actually prove some identity, and while starting to learn of those identities nonetheless, extended precision would seem especially relevant. "Seriously, I can generate Pi with that summation series?" Lets check. Just writing the program is a great workout. Some subscribers may recall a contest here on edu-sig, for Pi Day (3/14), to generate same to a 1001 places, given one of Ramanujan's convergence expressions for the algorithm. https://github.com/4dsolutions/Python5/blob/master/Pi%20Day%20Fun.ipynb http://mathforum.org/kb/thread.jspa?threadID=2246748 I had an adventure in gmpy2 just recently when my friend David Koski shared the following: from math import atan as arctan ? = (1 + rt2(5))/2 arctan( ? ** 1) - arctan( ? ** -1) == arctan(1/2) arctan( ? **-1) - arctan( ? ** -3) == arctan(1/3) arctan( ? **-3) - arctan( ? ** -5) == arctan(1/7) arctan( ? **-5) - arctan( ? ** -7) == arctan(1/18) arctan( ? **-7) - arctan( ? ** -9) == arctan(1/47) arctan( ? **-9) - arctan( ? **-11) == arctan(1/123) ... Without offering any kind of algebraic proof, I just wanted to see if the arithmetic panned out. These denominators on the right turned out to be a "bisection of the Lucas numbers" (like Fibonaccis with a different seed). That's a great job for a Python generator, and only integers are involved. But am I really confined to verification (not proof) using floating points? Not at all. At first it seemed that way thought, because whereas Decimal supports powering and roots, it's not equipped with atan. Then I remembered gmpy2 and could all of a sudden push the number of verifying decimals out past 92. Definitely a calculator couldn't do this. https://github.com/4dsolutions/Python5/blob/master/VerifyArctan.ipynb Math students the world over, if free of the tyranny of calculators -- or at least allowed to aid and abet (supplement) with Raspberry Pi etc. -- get to dabble in these industrial strength algorithms, a part of their inheritance. Indeed lets use Python as a calculator sometimes, in accordance with said Python.org tutorial. A much stronger calculator, with a bigger screen, more keys, and a lot more horsepower. Kirby PS: I ran into this problem with gmpy2.atan: the above convergence wasn't verifying beyond like 19 digits. When I switched to gmpy2.atan2 istead, everything started to work out. The question being, why should atan(x) vs atan2(y,x) differ except in terms of API? gmpy2.atan2(y,x) computes the arctan of y/x but in some other way apparently. Food for thought. I did do some digging in the docs. -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Sun Oct 7 18:24:12 2018 From: wes.turner at gmail.com (Wes Turner) Date: Sun, 7 Oct 2018 18:24:12 -0400 Subject: [Edu-sig] adventures in using Python as a calculator In-Reply-To: References: Message-ID: Speaking of proofs and not calculators, this dropped on HN this week: "Formalizing 100 theorems in Coq" > This is an appendix to Freek Wiedijk's webpage on the "top 100" mathematical theorems, to keep track of the statements of the theorems that are formalised in Coq. https://madiot.fr/coq100/ ... There's a JS implementation of Coq: https://github.com/ejgallego/jscoq/blob/master/README.md#homotopy-type-theory https://github.com/HoTT/book Optimal Coq/Jupyter integration may require extending the kernel interface: https://github.com/jupyter/jupyter/issues/333 Is there a good way to do proof modeling in Python? What's your favorite Python-basee CAS? On Sunday, October 7, 2018, kirby urner wrote: > > A stereotype some people have, of computers, is they're like giant > calculators on steroids. > > Then they find as much "text processing" goes on as "number crunching" -- ala > "regular expressions" -- and forget about the calculator model. > Calculators don't do strings, let alone much in the way of data files. > Of course that line got blurred in the golden age of programmable > calculators (HP65 etc.). > > However, the Python docs start with Using Python as a Calculator in > Guido's tutorial. > > Perhaps we could do more to fulfill the "on steroids" expectations (that > the computer is a "beefed up" calculator device) by exploring our number > types in more depth, and in particular by exploiting their superhuman > abilities in the extended precision department. > > Yes, the int type is awesome, now that it integrates long int (for those > new to Python, these used to be separate), but lets not forget Decimal and > also... gmpy, or actually gmpy2. > > I've probably lost even some seasoned Python teachers in jumping to that > relatively obscure third party tool, providing extended precision > numeracy beyond what Decimal (in Standard Library) will do. gmpy has a > long history, predating Python. I'm not the expert in the room. > > In particular, it does trig. > > Our Python User Group used to get one of the package maintainers from > nearby Mentor Graphics (Wilsonville). He was adding complex numbers to the > gmpy mix, and was in touch with Alex Martelli. I enjoyed our little > chats. > > Without having all the higher level math it might take to actually prove > some identity, and while starting to learn of those identities nonetheless, > extended precision would seem especially relevant. > > "Seriously, I can generate Pi with that summation series?" Lets check. > > Just writing the program is a great workout. > > Some subscribers may recall a contest here on edu-sig, for Pi Day (3/14), > to generate same to a 1001 places, given one of Ramanujan's convergence > expressions for the algorithm. > > https://github.com/4dsolutions/Python5/blob/master/Pi%20Day%20Fun.ipynb > http://mathforum.org/kb/thread.jspa?threadID=2246748 > > I had an adventure in gmpy2 just recently when my friend David Koski > shared the following: > > from math import atan as arctan > ? = (1 + rt2(5))/2 > arctan( ? ** 1) - arctan( ? ** -1) == arctan(1/2) > arctan( ? **-1) - arctan( ? ** -3) == arctan(1/3) > arctan( ? **-3) - arctan( ? ** -5) == arctan(1/7) > arctan( ? **-5) - arctan( ? ** -7) == arctan(1/18) > arctan( ? **-7) - arctan( ? ** -9) == arctan(1/47) > arctan( ? **-9) - arctan( ? **-11) == arctan(1/123) > ... > > Without offering any kind of algebraic proof, I just wanted to see if the > arithmetic panned out. > > These denominators on the right turned out to be a "bisection of the Lucas > numbers" (like Fibonaccis with a different seed). That's a great job for > a Python generator, and only integers are involved. > > But am I really confined to verification (not proof) using floating > points? Not at all. At first it seemed that way thought, because whereas > Decimal supports powering and roots, it's not equipped with atan. > > Then I remembered gmpy2 and could all of a sudden push the number of > verifying decimals out past 92. Definitely a calculator couldn't do this. > > https://github.com/4dsolutions/Python5/blob/master/VerifyArctan.ipynb > > Math students the world over, if free of the tyranny of calculators -- or > at least allowed to aid and abet (supplement) with Raspberry Pi etc. -- get > to dabble in these industrial strength algorithms, a part of their > inheritance. > > Indeed lets use Python as a calculator sometimes, in accordance with said > Python.org tutorial. > > A much stronger calculator, with a bigger screen, more keys, and a lot > more horsepower. > > Kirby > PS: I ran into this problem with gmpy2.atan: the above convergence wasn't > verifying beyond like 19 digits. When I switched to gmpy2.atan2 istead, > everything started to work out. The question being, why should atan(x) vs > atan2(y,x) differ except in terms of API? gmpy2.atan2(y,x) computes the > arctan of y/x but in some other way apparently. Food for thought. I did > do some digging in the docs. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Wed Oct 10 12:50:46 2018 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 10 Oct 2018 09:50:46 -0700 Subject: [Edu-sig] Jupyter Notebooks in the news again, thanks to Paul Romer Nobel Prize Message-ID: Some links: https://developers.slashdot.org/story/18/10/09/0042240/economics-nobel-laureate-paul-romer-is-a-python-programming-convert https://qz.com/1417145/economics-nobel-laureate-paul-romer-is-a-python-programming-convert/ Shades of Atlantic Monthly, April issue (mentioned in 2nd link): https://www.theatlantic.com/science/archive/2018/04/the-scientific-paper-is-obsolete/556676/ Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Wed Oct 10 14:04:57 2018 From: wes.turner at gmail.com (Wes Turner) Date: Wed, 10 Oct 2018 14:04:57 -0400 Subject: [Edu-sig] Jupyter Notebooks in the news again, thanks to Paul Romer Nobel Prize In-Reply-To: References: Message-ID: "Citing packages in the SciPy ecosystem" https://www.scipy.org/citing.html "[Python-Dev] Official citation for Python" - Tools for citations - Whether it's even appropriate to cite Python? - How to cite a version of a schema:SoftwareApplication https://groups.google.com/forum/m/#!topic/dev-python/wVKxq_cvVfM On Wednesday, October 10, 2018, kirby urner wrote: > Some links: > > https://developers.slashdot.org/story/18/10/09/0042240/ > economics-nobel-laureate-paul-romer-is-a-python-programming-convert > > https://qz.com/1417145/economics-nobel-laureate-paul- > romer-is-a-python-programming-convert/ > > Shades of Atlantic Monthly, April issue (mentioned in 2nd link): > > https://www.theatlantic.com/science/archive/2018/04/the- > scientific-paper-is-obsolete/556676/ > > Kirby > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From perrygrossman2008 at gmail.com Fri Oct 12 11:53:55 2018 From: perrygrossman2008 at gmail.com (Perry Grossman) Date: Fri, 12 Oct 2018 11:53:55 -0400 Subject: [Edu-sig] "Data Science for Undergraduates: Opportunities and Options (2018)" In-Reply-To: References: Message-ID: FYI, National Academies of Sciences, Engineering, and Medicine; report that may be of interest to you. "Data Science for Undergraduates: Opportunities and Options (2018)" https://www.nap.edu/catalog/25104/data-science-for-undergraduates-opportunities-and-options I just skimmed parts; looks interesting. But quite wordy and much higher level than the applied work I hope to get back to now, using Python. Perry -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Mon Oct 29 18:16:38 2018 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 29 Oct 2018 15:16:38 -0700 Subject: [Edu-sig] learning Unicode through Jupyter (with Python) Message-ID: Since full unicode is the current range of the default string type (str), I find my initial explorations of strings often swerve into chess pieces, playing cards, emoji. Speaking of playing cards: I'm surprised to discover an unfamiliar face card this late in life. Unicode has a "Knight" (letter C) in all four suits. I'm so used to Bicycle decks with suits of 13. I chop out all the Knights using slice notation in the Notebook linked below. The playing card motif is especially apropos around Python given the logo has that face card symmetry, if you know what I mean. I believe Luciano Ramahlo does playing cards quite a bit, along with little flag GIFs (served by nginx), which I think these days could be emoji. If not bothering with Unicode, then why not just: from random import shuffle suits = "Hearts Clubs Spades Diamonds".split() # chop me up royals = "Ace Jack Queen King".split() # could Ace be a she? Sure! normals = [str(i) for i in range(2, 11)] # starts at 1, stops at 10 deck = [ ] # I'm an empty list for s in suits: # outer loop for n in [royals[0]] + normals + royals[1:]: # Ace, normals, rest card = (n, s) # (suit, face value) deck.append(card) deck += ["Joker", "Joker"] # need these too! print("Fresh from box:\n", deck) shuffle(deck) print("Shuffled:\n", deck) But then we'd probably want instances of the Deck class no? Self shuffling. Besides, I think bothering with Unicode is worth the effort. Lets not lazily pretend we still live in the days of ASCII. Copying over from a publicly shared Jupyter listserv, one of mine from yesterday: === "Orthogonal" to the programming languages (yet pops up in most of them): Unicode. http://nbviewer.jupyter.org/github/4dsolutions/SAISOFT/blob/master/Unicode_Fun.ipynb I'm finding Jupyter fun for exploring Unicode, in part because of HTML( ) enlargement possibility. I approach it through Python, but other kernels could do that too. I second Lee's enthusiasm for the Jake Vanderplas tutorials. He gave a great keynote at a Pycon I went to here in Portland. Kirby On Sun, Oct 28, 2018 at 8:19 PM Lee Smith wrote: > > > On Wednesday, October 17, 2018 at 7:30:53 AM UTC-7, akash deep srivastava > wrote: >> >> hi i am akash i'am student of today i'am staring a jupyter . i dont know >> what is jupyter and what is the use so please help me and guide to jupyter . >> > > Jupyter is a Browser that easily allows programming experiments. First in > Python, now there are C++ kernels being adopted. You will find Juyper > very useful since on line a number of people are publishing free courses > written in a notebook. Consider https://github.com/jakevdp. One of > his 'Repitories' -- folders is a complete elementary course in Python. " > WhirlwindTourOfPython " > > > === -------------- next part -------------- An HTML attachment was scrubbed... URL: