Closed seattleacademy closed 5 years ago
We left the exponent reporter out mostly because you can build it yourself (as you've done) and because Scratch also doesn't have it. However, I agree that it could just be in a library. @brianharvey , your call!
This has long been the paradigmatic example of a feature left out on purpose because it's such a rich mine of student exploration, starting with an integer-exponent version as an easy recursive function, and working up to the full real-exponent version as students get into log and exponential functions. But I agree that we could put it in a math library. I've flagged this "discussion ongoing" because there are other such things, e.g., ccw-from-east directions, remove-one-copy-of-item-from-list, index-of-item-in-list, basically the whole Common Lisp primitive set. Is "put it in a library" always the right answer to such requests? Or are there problems so rich that we should avoid solving them for students? (How about exact rationals, for example? At Berkeley we deliberately degraded the division operator in our version of Scheme to give a decimal result for division of integers with a non-integer quotient, because SICP uses exact rational arithmetic as an extended example of data abstraction.)
I think the request, and desire for a more powerful set of Math functions comes up. Math.pow()
was the first thing I wrote as a JS Function!
I certainly agree that you can gain lots of benefits by writing a power function yourself, and there's lots of cool math tricks to be explored in that process. I think the problem is that a lack of these functions can get in the way of students exploring and creating other projects. So it becomes about teaching priorities.
In that sense, the library makes the most sense. (To me.) However, once you put something in a library, you remove a LOT of the motivation to build things yourself or to learn how to do so. I don't think you lose all the motivation though, it just requires more work than telling students "let's build a power function", which is hardly interesting to most people.
My vote would be a "Math" library which has a lot of options, mostly written in JS for speed. Because they're written in JS, that would also enable more curious students to learn how to write them in Snap!.
One of my students @jordanisaacs has submitted a pull request with pow as the first block for a basic-math library. My suggestion is that I have him and other students write various math functions they think might be useful, although it would probably be the case that only a subset of these would be appropriate for the basic-math.xml library. But at least this could get the conversation going about what should be included, what might be appropriate for things like a statistics or matrix library, and what should be left as "an exercise for the reader".
That's fine. I'll take a look at it later this week.
Thanks, @brianharvey. I have asked each of my students to come up with at least one block that they think could be useful and it is due a week from Thursday (May 19). I would suggest we save the discussion of culling the list until after that time, with any comments just on the appropriate implementation of the blocks. Obviously, the extent of the available library functions is a philosophical question, but we might as well have a larger list rather than a smaller list to choose from. And it is kind of fun to have high-school students contributing to an open-source project like this one that other students may use.
For many students, the required math to write a power function is well beyond where they are, but using a power function is not.
Note that to do a real power function isn't so easy. It should handle negative and fractional powers as well as negative bases.
base^exponent = e^(exponent * ln(base)) won't work very well for -2^3 or -8^(1/3) for example.
Happy to report that this has been added to the upcoming Snap5 version. Thank y'all, closing...
I teach high school math and programming classes, and am using Snap for the first time with my students. The lack of a power function makes modeling things exponential growth/decay, geometric series, working with most power functions, etc. difficult. Adding the equivalent of the javascript Math.pow(base,exponent) would make using Snap for the models we use in high-school math much easier. I would suggest adding this either to the basic set of Operator blocks, or at least to the "official library of powerful blocks". Note that for a workaround, we create a block that makes base^exponent = e^(exponent * ln(base)). We also have tried making a javascript block that calls Math.pow(base,exponent). However both workarounds turn a simple math lesson into a configuration exercises to use Snap for exploring math ideas that come up frequently in high school.
--Gary Anderson