As it says in the comments:
"The biggest limitation is the use of scoreboards for output, as they are only capable of showing one decimal place of accuracy."
Actually, the new scoreboards will change to show more decimal places when the number is between -1 and 1, but it is a sudden jump from one place after the decimal to 6 places.
I was considering using my print_scientific program to replace the scoreboard.
I have tried to understand how you can print several decimal places for your stack x variable. I cannot see it. I have the new beta version of scratch and I do understand print_decimal.sb, but I do not see anything here that makes the web program print several places. Even the downloaded version of PRN prints only to one place on my computer. Am I missing something obvious?
Thanks for any guidance you can provide. --- Lee
I am planning to re-implement the calculator in v1.2.
It should be much easier now! I should check to see if the variable display problems in v1.1 have been fixed in v1.2 beta.
I could probably implement approximations to hyperbolic functions, but I'd have to do some library research first, as I don't know the best approximation methods for computing them.
Once you get used to RPN, there's no going back.
Another benefit is that there is no need for a clear key or an equal key. The enter key replaces those as well as removing the need for parenthesis ( ).
We had to program something similar in Pascal! It was a text-base programming assignment, of course.
I miss my HP calculator, too.
Nice calculator! I once had also an HP 41CV.
Just as a side matter, I once taught my 10 years daughter how to "verbalize" math operations (she was in 5th grade I think... For instance "the sum of 4 and 3"
In current math is 4+3 (of course)
However is Lisp is (+ 3 4)...
Yeah, she learned Lisp in a few minutes :-)
I've thought about ways to get better display. I'll probably rewrite my print_decimal script to handle scientific or engineering notation (so that 31569 would be printed as 31.569e+03), then replace the variable-display windows (which I regard as badly broken in scratch) with the print_display.
very clever and fantastically wellmade. im impressed by how you allow numbers to change in value when another number is pressed. i mean how when you press 3 it is worth 3 but if you then press for the three is worth 30. just an idea, if you multiply an answer by ten you effectively get an extra decimal place.
java implementation truncates results of e^x at ridiculously low value (around e^41.366), while the squeak implementation works well up to a reasonable level, but crashes when you try e^1000
The RPN concept is simple---you have to have the numbers to manipulate *before* you do an operation on them. It allows complex operations without needing parentheses or operator precedence. Once you get used to using it, you wonder why anyone would use an infix calculator!
A serious bug is introduced by scratch when it saves the program. I entered 0.0000001 as the error limit, but it got converted to 1.e-07 by scratch (ok so far). When scratch saved the program, it changed the 1.0e-7 to 1, which is *NOT* ok.
Jamie, this is a reverse-polish notation calculator, like an HP scientific calculator. You put in a number, hit enter, put in another number, hit the operator. RPN calculators are easier to implement and easier to use than parenthesis calculators, but they take a little getting used to for people who have been corrupted by TI calculators.
Download the 29 sprites and 80 scripts of "RPN_calculator" and open it in Scratch
Project Notes
This project is a simple reverse-Polish notation calculator.
The biggest limitation is the use of scoreboards for output, as they are only capable of showing one decimal place of accuracy.
Input and computation is maintained to the precision of the floating-point numbers, but there is no scientific notation (powers of ten).
arctan is only computed to nearest degree (in squeak interpreter, but to full precision in Java interpreter).
Now with backspace and exp(x).
Comments
You need to be logged in to post comments
Add a Comment
very nice
As it says in the comments: "The biggest limitation is the use of scoreboards for output, as they are only capable of showing one decimal place of accuracy." Actually, the new scoreboards will change to show more decimal places when the number is between -1 and 1, but it is a sudden jump from one place after the decimal to 6 places. I was considering using my print_scientific program to replace the scoreboard.
I have tried to understand how you can print several decimal places for your stack x variable. I cannot see it. I have the new beta version of scratch and I do understand print_decimal.sb, but I do not see anything here that makes the web program print several places. Even the downloaded version of PRN prints only to one place on my computer. Am I missing something obvious? Thanks for any guidance you can provide. --- Lee
This has been upgraded to (link to project)">(link to project) using the functions of Scratch v1.2.1
Wow.
I am planning to re-implement the calculator in v1.2. It should be much easier now! I should check to see if the variable display problems in v1.1 have been fixed in v1.2 beta.
I have implemented hyperbolic functions in a scratch project in 1.2 beta but i have not yet added the inverses. (link to project)">(link to project)
I could probably implement approximations to hyperbolic functions, but I'd have to do some library research first, as I don't know the best approximation methods for computing them.
Hey kevin_karplus do you know how to make a scratch project demonstrating the hyperbolic trigonometric functions and the inverse of them?
I have made a copy of this with a slight improvement. If you try to divide by zero, the divide button flashes. (link to project)">(link to project)
Once you get used to RPN, there's no going back. Another benefit is that there is no need for a clear key or an equal key. The enter key replaces those as well as removing the need for parenthesis ( ). We had to program something similar in Pascal! It was a text-base programming assignment, of course. I miss my HP calculator, too.
too confusinn
Nice calculator! I once had also an HP 41CV. Just as a side matter, I once taught my 10 years daughter how to "verbalize" math operations (she was in 5th grade I think... For instance "the sum of 4 and 3" In current math is 4+3 (of course) However is Lisp is (+ 3 4)... Yeah, she learned Lisp in a few minutes :-)
I've thought about ways to get better display. I'll probably rewrite my print_decimal script to handle scientific or engineering notation (so that 31569 would be printed as 31.569e+03), then replace the variable-display windows (which I regard as badly broken in scratch) with the print_display.
very clever and fantastically wellmade. im impressed by how you allow numbers to change in value when another number is pressed. i mean how when you press 3 it is worth 3 but if you then press for the three is worth 30. just an idea, if you multiply an answer by ten you effectively get an extra decimal place.
java implementation truncates results of e^x at ridiculously low value (around e^41.366), while the squeak implementation works well up to a reasonable level, but crashes when you try e^1000
The RPN concept is simple---you have to have the numbers to manipulate *before* you do an operation on them. It allows complex operations without needing parentheses or operator precedence. Once you get used to using it, you wonder why anyone would use an infix calculator!
Not get it
Into the program.
I don't understand because I am young and not used to these types of calculators. But I am intelligent enough to get the gifted program.
Excellent work. Makes me sentimental for my old HP-41CV...
Wow! Your method of doing the trig functions is awesome. What a great idea!
Bug worked around by using large number instead of small number.
A serious bug is introduced by scratch when it saves the program. I entered 0.0000001 as the error limit, but it got converted to 1.e-07 by scratch (ok so far). When scratch saved the program, it changed the 1.0e-7 to 1, which is *NOT* ok.
It is a calculator. It calculates. I've upgraded to include some trig functions. Arctan works *better* in java implementation than squeak.
what is it surposed to do
Jamie, this is a reverse-polish notation calculator, like an HP scientific calculator. You put in a number, hit enter, put in another number, hit the operator. RPN calculators are easier to implement and easier to use than parenthesis calculators, but they take a little getting used to for people who have been corrupted by TI calculators.
what?????????????