RPN_calculator

Your browser needs java to view projects. Click here to install Java.

user_icon kevin_karplus shared it 2 years, 7 months ago
1047 views, 2 taggers, 15 people love it, 5 remixes by 4 people, 191 downloads, in 6 galleries
Add to my favorites?
Flag as inappropriate?

Comments

You need to be logged in to post comments

Add a Comment

 
DrSuper DrSuper 10 months, 1 week ago

very nice

kevin_karplus kevin_karplus 1 year, 9 months ago

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.

la_appels la_appels 1 year, 9 months ago

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

kevin_karplus kevin_karplus 1 year, 10 months ago

This has been upgraded to (link to project)">(link to project) using the functions of Scratch v1.2.1

Chrispy Chrispy 1 year, 11 months ago

Wow.

kevin_karplus kevin_karplus 1 year, 12 months ago

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.

pasta3049 pasta3049 1 year, 12 months ago

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)

kevin_karplus kevin_karplus 2 years ago

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.

Oldschooler2 Oldschooler2 2 years ago

Hey kevin_karplus do you know how to make a scratch project demonstrating the hyperbolic trigonometric functions and the inverse of them?

pasta3049 pasta3049 2 years, 1 month ago

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)

lanying lanying 2 years, 1 month ago

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.

Corkscrew55 Corkscrew55 2 years, 3 months ago

too confusinn

jasa jasa 2 years, 4 months ago

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 :-)

kevin_karplus kevin_karplus 2 years, 5 months ago

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.

bigB bigB 2 years, 5 months ago

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.

kevin_karplus kevin_karplus 2 years, 5 months ago

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

kevin_karplus kevin_karplus 2 years, 5 months ago

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!

Kaydoodle13 Kaydoodle13 2 years, 5 months ago

Not get it

Kaydoodle13 Kaydoodle13 2 years, 5 months ago

Into the program.

Kaydoodle13 Kaydoodle13 2 years, 5 months ago

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.

chalkmarrow chalkmarrow 2 years, 5 months ago

Excellent work. Makes me sentimental for my old HP-41CV...

jimmit jimmit 2 years, 5 months ago

Wow! Your method of doing the trig functions is awesome. What a great idea!

kevin_karplus kevin_karplus 2 years, 5 months ago

Bug worked around by using large number instead of small number.

kevin_karplus kevin_karplus 2 years, 5 months ago

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.

kevin_karplus kevin_karplus 2 years, 5 months ago

It is a calculator. It calculates. I've upgraded to include some trig functions. Arctan works *better* in java implementation than squeak.

chella_bella123 chella_bella123 2 years, 5 months ago

what is it surposed to do

kevin_karplus kevin_karplus 2 years, 6 months ago

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.

jamie jamie 2 years, 6 months ago

what?????????????

Please Wait...