Lecture 2: Python as a Calculator

April 1, 2020

Downloads

Session log

Mike Harms
2020-04-01 08:59:37
Welcome to Scientific Computing Day 2! Happy Poisson d’avril! :paper_fish:
Maggie Weitzman
2020-04-01 09:00:19
Hi Mike, which channel did you post the URL for today? I can't seem to find it
Maggie Weitzman
2020-04-01 09:00:34
Nevermind, found it in general 🙂

Lila Kaye
2020-04-01 09:02:41
can you post it here?
Joseph Harman
2020-04-01 09:03:04
Joseph Harman
2020-04-01 09:14:06
Mike Harms
2020-04-01 09:19:51
“I’m done with the 02_python-as-calculator notebook I would rate my understanding:” “😱” “🙁” “😐” “🙂” “😄”
Polly Poll
2020-04-01 09:20:03
Poll by @Mike Harms
I’m done with the 02_python-as-calculator notebook I would rate my understanding:
😱⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ 0
🙁⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ 0
😐██████ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢6
🙂████ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢4
😄██████████████ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢14
Mike Harms
2020-04-01 09:20:12
Anything you’d like to discuss as a group from the 02_python-as-calculator notebook (Reply in thread. )

Sophia Phillips
2020-04-01 09:26:36
Question: Why did the second cell have "print" preceding math in order to output answers when the first cell did not?

Katie Fisher
2020-04-01 09:36:21
discuss the last implement section

Cathy Robinson
2020-04-01 09:40:21
yes, the last section please! how do we write the squigley equals sign? and is that “natural log?”

Cori Cahoon
2020-04-01 09:41:58
What is the correct way to type in the code for Stirling's approximation? And I second the squigley equal sign...

Amber Rolland
2020-04-01 09:53:49
@Cathy Robinson math.log is by default the natural log because base e is the default. it actually takes more than one argument though. so you could put math.log(n,10) to get the base 10 log.

Cathy Robinson
2020-04-01 09:54:27
Cool- thanks!
Alice Barkan
2020-04-01 09:22:51
I seem to be on my own in a breakout room, but that’s ok. I’ve already worked through this notebook.
Natanya Villegas
2020-04-01 09:31:06
Hi! tab for math. isn't working

Mike Harms
2020-04-01 09:31:33
Try hitting tab a couple of times to activate?
Dillon Willis
2020-04-01 09:42:32
Hey Mike, just a quick question. We got through everything and I feel that my understanding is 😄 but when we were looking at the factorial help function afterward it gave the following, so we tried it. What is the (x,/) representing in the help readout?

Joseph Harman
2020-04-01 09:49:09
unfortunately that's not a super helpful help readout - the input for math.factorial is a single number only - for example, math.factorial(5). So (4,/) isn't a valid input for this function (that's why it throws a cryptic syntax error)

Michael Shavlik
2020-04-01 09:49:41
The / means that there are no more parameters that can be included in that function. So if you saw function(x,y,/) that would mean that the function can take an x, and a y, and nothing else
👍1

Dillon Willis
2020-04-01 09:50:09
Ah okay, that’s what I was starting to think from what I’d seen. Thanks guys!

Joseph Harman
2020-04-01 09:52:42
Didn't know the / thing, good to know! Generally speaking, if you get a help output or error that is confusing, googling is your friend. Not all error outputs are terribly clear depending on how code is written/documented

Mike Harms
2020-04-01 10:53:19
Actually, I didn’t know the / thing either…
Philip Nosler
2020-04-01 09:44:04
Could we go over formatting "import math" and "math.stuff" again briefly?
Philip Nosler
2020-04-01 09:49:51
Ah, I get it! Never mind.