This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

qnanqing
qnanqing presents ...

2011/8/25

Grapher

I think its fun to see some mathematical graph so i made it in Greenfoot! :D Well its done now :D
Although itsnt finished yet..
Still learning about RPN and want to make one RPN parser :D

The source is very very messed up! Its not even an object oriented programming! :P Its just a scratch.

I'll clean the source later for documentation.


update 3/11/2011
The source code is now more Object Oriented

Disabled the zoom function (because the code isnt "honest" (not Object Oriented) :P )
Added mouse information, and map location on the screen.
Supported map drag

4868 views / 1012 in the last 7 days

Tags: simulation physics with-source math graph charts

open in greenfoot
Your browser does not support the canvas tag.
a) red b) blue c) yellow d) green Also, to be able to read in dynamic equations, there are several routes you could go. One is to build a simple parser for the the input (which would not be very simple to code probably). The other that I can think of is to implement a drag and drop interface for math operations so that you know for certain what has been entered. For example, to add two expressions, you could have a icon to drag in that has two placeholders for the expressions on either side of the "+" symbol, kind of like so: 2x == () * () -> (2) * (x) 2(x+1) == () * (() + ()) -> (2) * ((x)+(1)) That way, you know what the equation parses to in advance because you force it to behave that way. The other way I can think of, and probably the easiest is to implement is a parser that uses prefix, function notation. So your equation c for example could be written like so: subtract( sqrt( abs( mult(x,10) ) ) , 10 ); Of course, that looks a bit messier, but it's one of the easier ways to do it. I hope this was helpful.
A new version of this scenario was uploaded on Thu Nov 03 15:38:47 UTC 2011 Disabled the zoom function (because the code isnt "honest") :P Added mouse information, and map location on the screen. Supported map drag
qnanqingqnanqing

2011/11/3

@supermagicmilk sorry for the late reply! i think i will use RPN for the parser, so now im working with the RPN parser (but first in different scenario!) :D
A new version of this scenario was uploaded on 2019-03-27 04:05:06 UTC Update to recent version of Greenfoot.
A new version of this scenario was uploaded on 2019-03-27 04:41:40 UTC Migrate from java.awt.Color to greenfoot.Color
A new version of this scenario was uploaded on 2019-03-27 04:42:11 UTC Migrate from java.awt.Color to greenfoot.Color

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.