Thursday, March 24, 2011

Graph 2D

Most phones come with a handy 4 function calculator. Android's calculator even give you some scientific functions. Nice. How about graphing? Most of your algebra and calculus class want you to find out properties of functions... where are the zeros? what are the y intercepts, etc. And graphs give you a visual view.

The idea of graphing is real simple. Give a list of x, plug that in the function to get a (x,y) to plot. But the catch is... how do you evaluate a function given a String of it? and how do you put a graph, let's say a box of (-5,-5) to (5,5) to a computer screen of (0,0) to (width,height)?

Evaluating a function is no trivial task for a non-interpreted language like C or Java. If you are interested you can see here. About plotting, we need to scale and translate the points.

Now with the touch screen, I can do something that a typical graphing calculator cannot do... and that is swipe on the screen and see the graph move.



Get Yours on Android Market

No comments:

Post a Comment